dynamic-css-link
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

dynamic-css-link

Dynamically load and operate css links

Installation

npm i dynamic-css-link

Getting Started

It's easy to load a css link.

import DynamicCssLink from 'dynamic-css-link';

const dcl = new DynamicCssLink();

const [light] = dcl.use({ src: './light.css' })

// dcl.hide(light) 
// dcl.teardown(light)

This example show how to load two css link and operate them.

import DynamicCssLink from 'dynamic-css-link';

const dcl = new DynamicCssLink();

const [light, dark] = dcl.use([
  { src: './light.css' },
  { src: './dark.css', alternative: true }  // Applied by default, but disabled.
]);

setTimeout(() => {
  dcl.show(dark).hide(light);
}, 4000);

Package Sidebar

Install

npm i dynamic-css-link

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

4.95 kB

Total Files

5

Last publish

Collaborators

  • yq612