Atomify your css - use css from npm modules and run the result through rework.
You want to use node modules with css on the front-end. Atomify-css helps you do that.
atomify-css takes an opts
object and a callback
.
The opts
object must contain an entry
key that is the relative path (from process.cwd()
) to the entry file for atomify.
The callback
will be called with an (optional) error
as it's first argument and atomified source
.
index.js
var css = require('atomify-css')
var opts = {
entry: './entry.css'
, variables: {
bg: 'black'
}
}
css(opts, function (err, src) {
// do something with the src
})
var css = require('atomify-css')
, stylus = require('stylus')
var opts = {
entry: './entry.css'
, transform: function (str, done) {
stylus.render(str, done)
}
}
css(opts, function (err, src) {
// do something with the src
})
entry.css
@import "./global.css";
@import "combobox";
@import "./inputs.css";
body {
background: var(bg);
}
Installing via npm is easy:
npm install atomify-css