Socket
Socket
Sign inDemoInstall

defer-css

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 0.0.5

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc