css-to-css.js
Compile css into js code that injects styles on the browser and is safe to run on the server.
How to use it
var cssToCssJs = ; var js = ;
Which returns
{if"undefined"==typeof documentreturn e;var t=documentn="CSS_TO_CSSJS";iftn=tn||{}!tnetne=!0;var r=t;return r"textContent"in r?rtextContent=e:rstyleSheetcssText=et0e}"body {color: blue;}";
When you execute that javascript:
In the browser
- injects the css into the
<head>
- returns the css code as a string
On the server
- returns the css code as a string
Typically you save the javascript to a file then you can require
it using browserify/node.
Install
$ npm install --save css-to-css.js
License
MIT