Skip to content

faeb187/style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Style

easily parse an array of styles to a minified css string.

Example

# put the file where you like
# example path: /client/lib/helpers/style.coffee
import { Style } from '/client/lib/helpers/style'

# example styles to parse
styles = [
  [ 'body', 'background', '#000'  ]
  [ 'body', 'overflow'  , 'hidden']
  [ 'h2'  , 'color'     , '#eee'  ]
]

# parse to minified css
console.log Style.parse styles

# console output:
# body{background:#000;overflow:hidden;},h2{color:#eee;}

# gets appended as <style> into <head>
Style.render styles

# you can set the id of <style>
# alredy existing style with id gets replaced
Style.render styles, id: 'my-style'

CoffeeScript ES2015 Syntax

ES2015 import/export syntax was added in CoffeeScript version 1.11.0.

About

parse array of styles to minified css

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published