wepp

· a node based LESS/CSS and JavaScript Preprocessor ·

0.4.0

wepp is a node module that processes LESS, CSS and JavaScript files in order to combine and minify them for production use. It depends on and makes use of the node modules underscore, less and uglify-js.

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 are available on GitHub where you'll also find a changelog.

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 wepp

This will create a sub directory node_modules containing all the needed files in the current working directory. Now you can use wepp in the current working directory and all its sub directories.

How to use it

From JavaScript

After installing the module you can use it in your JavaScript

var wepp = require("wepp");

wepp.processFile(options, inFile, outFile)

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

From the 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 <FILE> --outFile <FILE>
		wepp [Options] --inDir <DIR> --outDir <DIR>

Options:
	--cs
	--charset
		source and target file encoding
		default: utf-8

	--lb
	--linebreak
		desired line length in target files
		-1: no line breaks
		default: -1

	--nc
	--no-compression
		turns off compression

	--sh
	--strip-header
		strips even header comments in case of compression

API

processFile

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

processDir

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

processArgs

// see command line arguments for possible values for args
wepp.processArgs(args: [String, ...])

Options

Options {

	// source and target file encoding
	charset: "utf-8"

	// desired line length in target files
	// -1: no line breaks
	linebreak: -1

	// use compression for target files
	compress: true

	// strip header comments in case of compression
	stripHeader: false
}

Contact

Lars Jung
lrsjng [at] gmail [dot] com
@lrsjng

License

wepp is provided under the terms of the MIT License.

Included is the JavaScript port of the CSS minification tool distributed with YUICompressor (BSD License).