stylecow-core
v2.5.0
Published
Stylecow core library
Downloads
23
Maintainers
Readme
Stylecow core
Fast and furious css processor. For node >= v4.0
- See the wiki for more documentation
- Stylecow home page
Simple usage example:
"use strict";
let stylecow = require('stylecow-core');
//Create a Tasks instance and add some stuff
let tasks = (new stylecow.Tasks())
//minimum browser support
.minSupport({
explorer: 9,
firefox: 30,
chrome: 30,
safari: 6,
ios: 6,
opera: 12
})
//add some plugins
.use(require('stylecow-plugin-prefixes'))
.use(require('stylecow-plugin-nested-rules'))
.use(require('stylecow-plugin-color'))
//custom tasks
.addTask({
filter: {
type: 'Keyword',
name: 'grey'
},
fn: keyword => keyword.name = 'gray'
});
//Create a Coder instance to minify the css code
let coder = new stylecow.Coder('minify');
//Parse a css file
let css = stylecow.parseFile('styles.css');
//Execute the tasks
tasks.run(css);
//Get the minified code
let code = coder.run(css);
console.log(code.css);