less-toolkit
This is a bundle of Node.JS developer utilities for working with LESS files.
The utilities included:
CLI
A simple command-line interface for processing less files. It can take a file or path and output CSS in a target directory. The options for compilation are read from a configuration file.
Usage:
$ node cli /path/to/input.less /path/to/output.css options.js
The inputs and outputs can be any the following variations:
inputfile.LESS -> outputfile.CSS
inputfile.LESS -> /output/path
/input/path -> /output/path
The optional fourth argument specifies an options file (for example, development)
Options:
- "debug": Enables debugging output
- "force": Forces overwrite of any existing CSS files
- "less" : An object passed directly to the less Parser.
File Watcher
A simple file watching daemon.
Usage:
$ node watcher /input/path /output/path /includes:/includes/subdir options.js &
The inputs and outputs can be any the following variations:
inputfile.LESS -> outputfile.CSS
inputfile.LESS -> /output/path
/input/path -> /output/path
The optional third argument is a colon-delimited list of other directories to watch (typically for LESS includes)
The optional fourth argument specifies an options file (for example, development)
Options:
- "watcher_match_pattern": filter for file names
- "debug": Enables debugging output
- "force": Forces overwrite of any existing CSS files
- "less" : An object passed directly to the less Parser.
Middleware
A simple Express-compatible middleware.
Usage:
...app;...
Options:
- "debug": Enables debugging output
- "force": Forces overwrite of any existing CSS files
- "less" : An object passed directly to the less Parser.
- "middleware_match": a function that returns true if the given URL should be handled by the middleware
{ return /\.css$/; }
- "middleware_map": a function that defines pairs of input / output for the given URL
{ return "input": path "output": path }
Processor library
A simple wrapper around the core Less parser. It takes an input, output, compilation options, and callback function. This library is re-used by the CLI, File Watcher, and Middleware.
License
MIT