Skip to content

topcoat/resin

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Resin

Build Status Code Climate Issue Count codecov npm version

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: