Generate and/or apply CSS with JavaScript. Check out the demo here.
Packages:
- cssx client-side library (download)
- cssx-transpiler (download or
npm i cssx-transpiler
) - gulp plugin (
npm i gulp-cssx -D
) - webpack loader (
npm i cssx-loader -D
)
Examples:
var updateStyles = function(size) {
cssx(
body {
font-size: `size`px;
}
body h1 {
font-size: 2em;
}
body small {
font-size: 0.8em;
}
);
}
updateStyles(18);
/* results in the following:
<style id="my-styles2" type="text/css">
body {
font-size: 18px;
}
body h1 {
font-size: 2em;
}
body small {
font-size: 0.8em;
}
</style>
*/
npm test
or if you want to run the tests continuously
npm run test-watch
or if you want to run the tests in a debug mode
npm run test-debug
npm i
npm run make
npm i
npm run dev