Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Does for languages that can be 'built' what consolidate.js does for templates
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.travis.yml
HISTORY.md
README.md
VERSIONS.md
index.js
package.json

README.md

Build Status

consolidate-build

Does for languages that can be 'built' what consolidate.js does for templates

Installation

$ npm install consolidate-build

Supported languages

All template engines supported by consolidate work in consolidate-build.

In addition to those, consolidate build adds:

NOTE: you must still install the engines you wish to use, add them to your package.json dependencies.

API

All templates supported by this library may be rendered using the signature (path[, locals], callback) or .render(str[, locals], callback) as shown below.

NOTE: All this example code uses build.less for the less stylsheet language. Replace less with whatever language you are using. For exmaple, use build.stylus for stylus, build.markdown or build.md for markdown, etc. console.log(build) for the full list of identifiers.

var build = require('consolidate-build');
build.less('styles/style.less', { compress: true }, function(err, css){
  if (err) throw err;
  console.log(css);
});

Or without options / local variables:

var build = require('consolidate-build');
build.less('styles/style.less', function(err, css){
  if (err) throw err;
  console.log(css);
});

To dynamically pass the engine, simply use the subscript operator and a variable:

var build = require('consolidate-build')
  , name = 'less';

build[name]('styles/style.css', function(err, css){
  if (err) throw err;
  console.log(css);
});

Without a file

All the languages support being built without a file being present. To do this ismply use the render method.

build.less.render('.class { width: 1 + 1 }', { compress: true}, function(err, css){
  if (err) throw err;
  console.log(css);
});
Something went wrong with that request. Please try again.