---
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/5/apis/tinymce.dom.stylesheetloader/index.md"
version: "5"
last_updated: "2024-03-26T08:09:19Z"
tokens: 563
---
Important This page documents TinyMCE 5. 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 calls the `success` callback if successfully loaded, otherwise calls `failure`. | `StyleSheetLoader` |
| [loadAll()](#loadAll) | Loads the specified CSS files and calls the `success` callback if successfully loaded, otherwise calls `failure`. | `StyleSheetLoader` |
| [unload()](#unload) | Unloads the specified CSS file if no resources currently depend on it. <br> *Added in TinyMCE 5.5* | `StyleSheetLoader` |
| [unloadAll()](#unloadAll) | Unloads each specified CSS file if no resources currently depend on it. <br> *Added in TinyMCE 5.5* | `StyleSheetLoader` |

## Methods

### load()

```javascript
load(url: String, success: Function, failure: Function)
```
Loads the specified CSS file and calls the `success` callback if successfully loaded, otherwise calls `failure`.

#### Parameters

- `url (String)` - Url to be loaded.
- `success (Function)` - Callback to be executed when loaded.
- `failure (Function)` - Callback to be executed when failed loading.

### loadAll()

```javascript
loadAll(urls: Array, success: Function, failure: Function)
```
Loads the specified CSS files and calls the `success` callback if successfully loaded, otherwise calls `failure`.

#### Parameters

- `urls (Array)` - URLs to be loaded.
- `success (Function)` - Callback to be executed when the style sheets have been successfully loaded.
- `failure (Function)` - Callback to be executed when the style sheets fail to load.

### unload()

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

*Added in TinyMCE 5.5*

#### 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.

*Added in TinyMCE 5.5*

#### Parameters

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