JavaScript style sheets
Switch branches/tags
Nothing to show
Clone or download
Benjamin De Cock
Benjamin De Cock Initial commit
Latest commit baa0f1b Feb 3, 2015
Permalink
Failed to load latest commit information.
LICENSE.txt Initial commit Feb 3, 2015
README.md Initial commit Feb 3, 2015
jscss.js Initial commit Feb 3, 2015

README.md

Usage

Insert jscss.js:

<script src=jscss.js></script>

Write your styles in JavaScript using this fancy syntax:

style(`

  body
    background #ccc

  div
    width 100px
    height 100px
    background white
    box-shadow 0 1px 2px rgba(0, 0, 0, .5)
    transform translateX(50%) scale(.5)

`)

Why

Because it drives me nuts to define some styles in my CSS file and some other styles that need to be computed in my JavaScript file. Having all my declarations in one place makes me 100% happier. Not having to type curly braces, colons and semicolons isn't unpleasant either.

Performance

jscss takes approximately 0.03s to parse and insert 10,000 lines of CSS (Firefox 35, OS X 10.10). Good enough. And it's just 20 lines (uncompressed), so the loading should be acceptable too.

Browser support

Any ES2015-friendly browser (which basically means Firefox 35 at the time of writing).