Awesome
Resin
A CSS preprocessor.
Installation
npm install resin
Usage
var resin = require('resin');
resin({
// Pass it a css file to process
src: 'src/entry.css',
// Tell it what browsers to prefix for
browsers: ['last 1 version', 'ios', 'android 4'],
// Add a namespace to your classes to avoid collisions
namespace: 'dam',
// Use the varibles plugin
vars: true,
// Use the inherit plugin
extend: true,
// Generate sourecemaps for debugging
debug: true
});
// returns a promise.
This function will return an evaluated string that you can write to a file, or stream etc.
Example writing to a file:
var resin = require('resin'),
write = require('fs').writeFileSync,
output;
resin({
// Pass it a css file to process
src: 'src/entry.css',
// Tell it what browsers to prefix for
browsers: ['last 1 version', 'ios', 'android 4']
// Add a namespace to your classes to avoid collisions
namespace: 'dam'
}).then(function(result){
write('path/to/output/dir/filename.css', result.css);
});
Entry CSS file
@import "node-package-name";
@import "other-node-package-name";
Resin will pull in CSS source files distributed via npm packages and add them to the AST. Uses postcss-import under the covers.
Features
Resin supports:
- Imports
- Variables
- Extend
- Namespacing
- Autoprefixer
- Source maps for debugging