jss-template

JSS plugin enables string templates

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
jss-template
1.0.16 years ago7 years agoMinified + gzip package size for jss-template in KB

Readme

JSS plugin enables string templates
Gitter
Make sure you read how to use plugins in general.
This plugin allows you to use string templates to declare CSS rules. It implements a very naive but very fast (~42000 ops/sec) runtime CSS parser, with certain limitations:
  • Supports only rule body (no selectors)
  • Requires semicolon and new line after the value (except of last line)
  • No nested rules support

const styles = {
  button: `
    border-radius: 3px;
    background-color: green;
    color: red;
    margin: 20px 40px;
    padding: 10px;
  `,
  '@media print': {
    button: `color: black`
  },
  '@keyframes id': {
    from: `opacity: 0`,
    to: `opacity: 1`
  }
}

Issues

File a bug against cssinjs/jss prefixed with \[jss-template\].

Run tests

npm i
npm run test

License

MIT