defer-css
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "defer-css", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Load css in your page without affecting load speed.", | ||
@@ -5,0 +5,0 @@ "main": "index.min.js", |
@@ -5,3 +5,3 @@ ### Defer Css | ||
##### Direct Browser Installation | ||
#### Direct Browser Installation | ||
```html | ||
@@ -17,3 +17,3 @@ <!--Using JsDeliver CDN--> | ||
``` | ||
##### From Package Managers | ||
#### From Package Managers | ||
You can include using `require` or `import` but defer-css does not export anything. | ||
@@ -24,4 +24,4 @@ | ||
##### Usage | ||
By default defined styles are loaded before the first `<link>` element in your page | ||
#### Usage | ||
Defined styles are loaded before the link element with `defer-css` id in your page | ||
```html | ||
@@ -48,7 +48,7 @@ <html> | ||
Load Css | ||
Load Css using javascript | ||
```javascript | ||
deferCss([ | ||
{href: 'style-1.min.css', crossorign: 'anonymous'}, | ||
{href: 'style-2.min.css', crossorign: 'anonymous'} | ||
'style-1.min.css', | ||
{href: 'style-2.min.css', crossorigin: 'anonymous'} | ||
], 'add-css-here') | ||
@@ -63,3 +63,5 @@ ``` | ||
If css object includes an `onload` function, it is executed when the css file is loaded. | ||
The values of the styles array can either be a url `string` or an `object` that will be used to build your `link` element | ||
If the object includes an `onload` function, it is executed when the css file is loaded. | ||
```javascript | ||
@@ -89,2 +91,3 @@ deferCss([ | ||
``` | ||
The `deferCssData` includes details you may need. | ||
@@ -111,3 +114,3 @@ ```javascript | ||
<!-- Links are placed before this element --> | ||
<add-css-here/> | ||
<link id="add-css-here"> | ||
</head> | ||
@@ -133,3 +136,3 @@ <body> | ||
let scripts = [ | ||
{href: 'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'}, | ||
'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css', | ||
// Style with onload | ||
@@ -136,0 +139,0 @@ { |
Sorry, the diff of this file is not supported yet
7949
147