1.0.1 • Published 2 years ago

style-attacher v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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();