Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dotsunited/load-css-polyfill

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotsunited/load-css-polyfill

A simple polyfill for asynchronously loading non-critical CSS using link[rel=preload].

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

load-css-polyfill

A simple polyfill for asynchronously loading non-critical CSS using link[rel=preload].

Introduction

Non-critical CSS can be loaded asynchronously by using <link rel="preload" as="style"> with a onload handler that switches rel="preload" to rel="stylesheet" once the file is loaded.

<link rel="preload" href="style.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="style.css"></noscript>

This package provides a polyfill for browsers which don't support link[rel=preload] yet.

Installation

npm

npm install @dotsunited/load-css-polyfill --save

Yarn

yarn add @dotsunited/load-css-polyfill

Usage

Import the package and invoke the polyfill()function.

import polyfill from '@dotsunited/load-css-polyfill';

polyfill();

Please note, that you should inline the script in your <head>.

Credits

This package is based on the technique developed by Scott Jehl as part of the loadCSS library.

License

Released under the MIT license.

Keywords

FAQs

Package last updated on 05 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc