Apply css only to a specific part of the document
npm install apply-css
Scoped CSS was a planned web platform feature in multiple browsers but was later
retracted due to high code complexity.
With apply-css this is possible in the browser using browserify.
There is a demo project using bootstrap + a theme here. Or see it directly live here.
- element is the element to apply the css to
- css is the stylesheet as a string to apply
See the example folder.
With the browserify transfrom brfs it is
possible to static-inline the css from a file:
``javascript`
var fs = require('fs')
var cssString = fs.readFileSync('style.css', { encoding: 'utf8' })
To run the tests simply run npm test`.