Skip to content

krasimir/cssx

Repository files navigation

CSSX - CSS in JavaScript

Generate and/or apply CSS with JavaScript. Check out the demo here.


Packages:

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>

*/

Testing

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

Building

npm i
npm run make

Developing

npm i
npm run dev

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages