style-attacher

1.0.1 • Public • Published

html-StyleAttacher

Attach styles to the page

Get

1. Directly use dist/StyleAttacher.js

Just load StyleAttacher.js by script tag and the StyleAttacher is the class object.

2. Install from npm

npm i style-attacher

Then in your javascript code:

import StyleAttacher from 'style-attacher'

Usage

const attacher=new StyleAttacher('define an unique name');

//attach a stylesheet by <link> tag
attacher.attachStyleSheet(`
a{cursor:unset;}
span{display:block;}
`);//this method dose not always work, in this case use the next method ↓

//attach a stylesheet by <style> tag
attacher.appendStyle(`
a{cursor:unset;}
span{display:block;}
`);

//reset all attached styles
attacher.resetStyle();

Package Sidebar

Install

npm i style-attacher

Weekly Downloads

8

Version

1.0.1

License

MIT

Unpacked Size

8.71 kB

Total Files

7

Last publish

Collaborators

  • luojia