0.2.1 • Published 11 years ago

getsmart-js v0.2.1

Weekly downloads
20
License
-
Repository
github
Last release
11 years ago

getsmart-js

Middleware for Express.js, a Node.js framework. Compresses, minifies and concats JavaScript and CoffeeScript at runtime.

What it does

getsmart-js intercepts GET requests for files ending in ".js". It checks to see if the modification date of the source file has changed since the last request, and updates the file if it has.

It optionally compresses and minifies the file (using uglify-js) – good for production.

If a request is made, and the source file is not found, getsmart-js looks for a folder with the same name as request (minus the '.js') and concatenates all files in that folder (including sub-folders). eg. Request URL is "app.js", but "app.js" is not in the source folder, so getsmart-js looks for a folder named "app".

Installation

Run "npm install getsmart-js" to install the module.

Usgage

Use getsmart-js as a middleware for Express.js.

eg. app.configure(function(){ app.use(require('getsmart-js')({ compress: true, isProduction: false, src: dirname, dest: dirname + '/public' })); };

Options

compress Boolean (optional) Whether to compress & minify or not. Defaults to NODE_ENV == 'production'.

isProduction Boolean (optional) Will only check modification dates the first run if true. Defaults to NODE_ENV == 'production'.

src String (required) The source directory of the source JavaScript files.

dest String (required) The destination directory for the processed files.

Notes on Directories

The file paths will include the request URL – so you must keep this in mind when setting the options.

eg. request URL = "/js/app.js", so getsmart will look for "app.js" inside the "js" folder in the source directory.

0.2.1

11 years ago

0.2.0

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago