Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Broccoli plugin for compiling .less files with n-to-one semantics

License

Notifications You must be signed in to change notification settings

tatango/broccoli-less-single

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

broccoli-less-single

The broccoli-less-single plugin compiles .less files with less.js.

This plugin is designed to compile a single, primary input file into a single output file, with a tree of @importd dependencies. This differs from broccoli-less, which compiles each .less file individually into a .css file and doesn't support @imports or a single output file depending on multiple inputs.

This code is based heavily on broccoli-sass

Installation

npm install --save-dev broccoli-less-single

Usage

var compileLess = require('broccoli-less-single');

var outputTree = compileLess(inputTrees, inputFile, outputFile, options)
  • inputTrees: An array of trees that act as the include paths for less. If you have a single tree, pass [tree].

  • inputFile: Relative path of the main .less file to compile. This file must exist in one of the inputTrees.

  • outputFile: Relative path of the output CSS file.

  • options: A hash of options for less.

Example

var appCss = compileLess(sourceTrees, 'myapp/app.less', 'assets/app.css')

@import-Example

/* file: sub.less */
h1 {
  font-size: 200em;
}

/* =================== */

/* file: app.less */
@import "sub.less";

html, body {
  margin: 20px;
}

Caching

This plugin determines whether or not to rebuild your LESS based on a stat cache of all LESS files in inputTrees (that is, any file that matches **/*.less. If any file in the tree has changed since your last build, it will rebuild your LESS.

Because of this, be careful to not pass in a huge tree (i.e. a vendor/ folder) to inputTrees, as it will recursively stat the files in it on each build.

About

Broccoli plugin for compiling .less files with n-to-one semantics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%