Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Development middleware to dynamically recompile derived files at serve-time.
tree: a2c66b4c18

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


connect middleware for dynamically recompiling derived files at serve-time. This module is designed for speeding up development; best-practices would have you compile all necessary files as part of your production deploy process. But you knew that, of course.

Usage is the same as all other connect middleware:

    var connect  = require('connect')
    ,   compiler = require('connect-compiler')

    ,   server = connect.createServer(
                src     : 'src'
                dest    : 'var'
                enabled : [ 'coffee', 'uglify' ]
            connect.static(__dirname + '/public'),
            connect.static(__dirname + '/var')



The compiler middleware takes a settings object, minimally containing a list of compilers to enable (enabled). Most uses will also specify a source directory (src).

name type default description
enabled String, String[] Required Enabled compiler id(s). See below for included compilers.
src String, String[] cwd Directories to search for source files to compile.
dest String src
src[0] if Array
Directory to write compiled result.
roots {src:dest, ...},
[[src, dest], ...]
Allows you to specify multiple, ordered src-dest pairs. Only one of roots or src is required; roots takes precedence over src if present.
log_level String , Number warn Logging verbosity. Valid values (case-insensitive): error, warn, info, debug, silent, or a numeric constant (as found in LOG).
create_dirs Boolean true Creates intermediate directories for destination files.
mount String Prefix trimmed off request path before matching/processing.
delta Number 0 Delta mtime (in seconds) required for a derived file to be considered stale, and therefore recompiled. By default, any change will cause a file to be recompiled on next request.
expires Boolean false Automatically treat files as stale if this old in secs.
external_timeout Number 3000 Milliseconds after which to kill subprocess commands.
cascade Boolean false Invoke all compilers that match? otherwise, only first.
resolve_index Boolean , String false If true-y, directories are resolved with the supplied filename, where true maps to 'index.html'.
allowed_methods String[] ['GET'] HTTP methods compiler should process. This setting is global-only -- per-compiler overrides specified via options will have no effect.
options {compilerId:settings, ...} Hash of additional per-compiler options, mapped by compiler id. Each compiler is supplied a copy of the settings object; if additional options are supplied in this way for a given compiler, they will be merged into the settings (and override any colliding top-level keys).


  • ### CoffeeScriptCompiler

  • ### CocoCompiler

  • ### CommonJSCompiler

  • ### UglifyCompiler

  • ### JadeCompiler

  • ### StylusCompiler

  • ### LessCompiler

  • ### SassJSCompiler

  • ### SassRubyCompiler

  • ### JisonCompiler

  • ### YamlCompiler


  • ### CompilerMiddleware(settings={}, ...custom)

  • ### Compiler

  • ### ExternalCompiler


Something went wrong with that request. Please try again.