@jswork/styled-css

Zero-runtime CSS string creator in JS library.

Usage no npm install needed!

<script type="module">
  import jsworkStyledCss from 'https://cdn.skypack.dev/@jswork/styled-css';
</script>

README

styled-css

Zero-runtime CSS string creator in JS library.

version license size download

installation

npm install @jswork/styled-css

usage

import css from '@jswork/styled-css';

const bg = '#f00';
const bg_ = '#f50';
const results = css`
  ${bg && 'background: ' + bg + ';'}
  ${bg_ && '> * { background: ' + bg + '; }'}
`;


// results
[
  '\n      ',
  'background: #f00;',
  '\n      ',
  '> * { background: #f00; }',
  '\n    '
] 

license

Code released under the MIT license.