wepp

a node based LESS and JavaScript preprocessor

Advertisement
0.6.0

wepp is a node module that processes LESS and JavaScript files in order to combine and minify them for production use. It depends on and makes use of fQuery.

wepp uses less.js to process LESS files and cssmin.js (from the JavaScript port of the CSS minification tool distributed with YUICompressor) to compress CSS files.

With wepp it is possible to include JavaScript files into other JavaScript files. The syntax is:

// @include "path/to/other/file.js"

the specified file will be looked up relative from the including file and its content will be copied into place. For JavaScript compression wepp uses UglifyJS.

The sources and a changlog are available on GitHub.

Installation

In order to install wepp you need node and npm to be installed. The benefit of using npm to install wepp is that it will automatically install all dependencies as well.

> npm install -g wepp

This will install wepp globally. You should now be able to use it from the command line:

> wepp --help

How to use it

Command line

There is a file bin/wepp in the package to make wepp usable from the command line. Make sure that this file is executable.

Usage: wepp [Options] --inFile  --outFile 
       wepp [Options] --inDir  --outDir 
 
  Options:
 
    -h, --help          output usage information
    -V, --version       output the version number
    --inFile [file]     source file
    --outFile [file]    target file
    --inDir [dir]       source directory
    --outDir [dir]      target directory
    --charset [string]  [NOT USED] source and target file encoding
    --linebreak [int]   max line length in target files
    --no-compression    turns off file compression
    --strip-header      strips even header comments in case of compression
    --size              prints file size and zipped file size of processed files
    --overwrite         overwrites already existing targets files

JavaScript/Node.js

After installing the module you can use it in your scripts

var wepp = require("wepp");
 
wepp.processFile(options, inFile, outFile)

Have a look at the API for a complete list of methods and options.

API

processFile

wepp.processFile(options: Options, inFile: String, outFile: String)

processDir

wepp.processDir(options: Options, inDir: String, outDir: String)

Options

Options {
 
    // [NOT USED] source and target file encoding
    charset: "utf-8"
 
    // max line length in target files
    // -1: no line breaks
    linebreak: -1
 
    // use compression for target files
    compression: true
 
    // strips even header comments in case of compression
    stripHeader: false
 
    // prints file size and zipped file size of processed files
    size: false
 
    // overwrites already existing targets files
    overwrite: false
}

License

wepp is provided under the terms of the MIT License.