Skip to content

ForbesLindesay-Unmaintained/consolidate-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated, use jstransformer

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);
});