---
title: "tinymce.dom.StyleSheetLoader"
description: "This class handles loading of external stylesheets and fires events when these are loaded."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.dom.stylesheetloader/"
md_url: "https://www.tiny.cloud/docs/tinymce/7/apis/tinymce.dom.stylesheetloader/index.md"
version: "7"
last_updated: "2023-11-22T11:35:31Z"
tokens: 677
---
Important This page documents TinyMCE 7. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../../latest/apis/tinymce.dom.stylesheetloader/).
# tinymce.dom.StyleSheetLoader

This class handles loading of external stylesheets and fires events when these are loaded.

## Summary

### Methods

| Name | Summary | Defined by |
| --- | --- | --- |
| [load()](#load) | Loads the specified CSS file and returns a Promise that will resolve when the stylesheet is loaded successfully or reject if it failed to load. | `StyleSheetLoader` |
| [loadAll()](#loadAll) | Loads the specified CSS files and returns a Promise that is resolved when all stylesheets are loaded or rejected if any failed to load. | `StyleSheetLoader` |
| [loadRawCss()](#loadRawCss) | Loads the specified css string in as a style element with an unique key. | `StyleSheetLoader` |
| [unload()](#unload) | Unloads the specified CSS file if no resources currently depend on it. | `StyleSheetLoader` |
| [unloadAll()](#unloadAll) | Unloads each specified CSS file if no resources currently depend on it. | `StyleSheetLoader` |
| [unloadRawCss()](#unloadRawCss) | Unloads the specified CSS style element by key. | `StyleSheetLoader` |

## Methods

### load()

```javascript
load(url: String): Promise
```
Loads the specified CSS file and returns a Promise that will resolve when the stylesheet is loaded successfully or reject if it failed to load.

#### Parameters

- `url (String)` - Url to be loaded.

#### Return value

- `Promise` - A Promise that will resolve or reject when the stylesheet is loaded.

### loadAll()

```javascript
loadAll(urls: Array): Promise
```
Loads the specified CSS files and returns a Promise that is resolved when all stylesheets are loaded or rejected if any failed to load.

#### Parameters

- `urls (Array)` - URLs to be loaded.

#### Return value

- `Promise` - A Promise that will resolve or reject when all stylesheets are loaded.

### loadRawCss()

```javascript
loadRawCss(key: String, css: String)
```
Loads the specified css string in as a style element with an unique key.

#### Parameters

- `key (String)` - Unique key for the style element.
- `css (String)` - Css style content to add.

### unload()

```javascript
unload(url: String)
```
Unloads the specified CSS file if no resources currently depend on it.

#### Parameters

- `url (String)` - URL to unload or remove.

### unloadAll()

```javascript
unloadAll(urls: Array)
```
Unloads each specified CSS file if no resources currently depend on it.

#### Parameters

- `urls (Array)` - URLs to unload or remove.

### unloadRawCss()

```javascript
unloadRawCss(key: String)
```
Unloads the specified CSS style element by key.

#### Parameters

- `key (String)` - Key of CSS style resource to unload.
