<commit_before># lazyload-css
Promise based method for adding a style sheet to the page if it has not already been added

## Install

```bash
yarn add lazyload-css
```

```bash
bower install lazyload-css
```

## Weigh In
#### Imported Weight 
When used with `require()` you'll notice very little weight is added to your bundle. 

```js
const lazyLoadCSS = require('lazyLoadCSS');
```

#### VanillaJS Weight
| Script        | Disk Size           | GZIP  |
| ------------- | ------------- | ----- |
| `lazyload-css.0.0.3.js`      | `4.26kB`      |   `1.33kB` |
| `lazyload-css.0.0.3.min.js`      | `1.56kB`      |   `702b` |

The UMD module wrapper weights more than the `lazyLoadCSS()` method itself.  
If you want to go rogue, you can [load directly from source](https://github.com/jpdevries/lazyload-css/blob/master/lazyload-css.js).

## Usage

`lazyLoadScript` accepts two parameters. The path to the script to load and an id.

```js
lazyLoadCSS('css/main.css', 'main').then(() => {
  // main.css is loaded now with an id of main
})
```
_The id parameter is optional. It is used to ensure that subsequent requests to load a script with that same id immediately resolve. If you omit the id parameter, the DOM will first be queried for a `<link>` with the same `href` attribute, before making a new request by appending a new `<link>` tag._

_`lazyLoadCSS` uses this id to ensure scripts with the same id are only loaded once. This allows web components to request dependencies with `lazyLoadCSS` and rest assured the sheets will only be loaded once regardless of how many times they are requested._

`lazyLoadCSS` is packaged as a UMD module so it can be included in several ways.

> The UMD pattern typically attempts to offer compatibility with the most popular script loaders of the day (e.g RequireJS amongst others). In many cases it uses AMD as a base, with special-casing added to handle CommonJS compatibility.  <commit_msg>updating README<commit_after># lazyload-css
Promise based method for adding a style sheet to the page if it has not already been added

## Install

```bash
yarn add lazyload-css
```

```bash
bower install lazyload-css
```

## Weigh In
#### Imported Weight
When used with `require()` you'll notice very little weight is added to your bundle.

```js
const lazyLoadCSS = require('lazyLoadCSS');
```

#### VanillaJS Weight
| Script        | Disk Size           | GZIP  |
| ------------- | ------------- | ----- |
| `lazyload-css.0.0.3.js`      | `4.26kB`      |   `1.33kB` |
| `lazyload-css.0.0.3.min.js`      | `1.56kB`      |   `702b` |

The UMD module wrapper weights more than the `lazyLoadCSS()` method itself.  
If you want to go rogue, you can [load directly from source](https://github.com/jpdevries/lazyload-css/blob/master/lazyload-css.js).

## Usage

`lazyLoadScript` accepts two parameters. The path to the script to load and an id.

```js
lazyLoadCSS('css/main.css', 'main').then(() => {
  // main.css is loaded now with an id of main
})
```
_The id parameter is optional. It is used to ensure that subsequent requests to load a script with that same id immediately resolve. If you omit the id parameter, the DOM will first be queried for a `<link>` with the same `href` attribute, before making a new request by appending a new `<link>` tag._

`lazyLoadCSS` uses this id to ensure scripts with the same id are only loaded once. This allows web components to request dependencies with `lazyLoadCSS` and rest assured the sheets will only be loaded once regardless of how many times they are requested.

`lazyLoadCSS` is packaged as a UMD module so it can be included in several ways.

> The UMD pattern typically attempts to offer compatibility with the most popular script loaders of the day (e.g RequireJS amongst others). In many cases it uses AMD as a base, with special-casing added to handle CommonJS compatibility.  
{'fraction_non_alphanumeric': 0.10869565217391304, 'fraction_numerical': 0.009316770186335404, 'mean_word_length': 3.422196796338673, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5115528', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1125, 'n_words': 523}