jmen

watch javascript(coffeescript) and css(scss, less) files, merge them into one file whenever one of the watched files is updated.

Introduction

jmen is a tool can merge javascript (including coffeescript) and css (including scss, less) files into one file whenever one of the included files is updated. To make it works, you need to install nodejs(http://www.nodejs.org/) first.

$ [sudo] npm install jmen -g
$ jmen --file /path/to/app/dev/index.js --output /path/to/website/assets/javascripts/app.js

file: /path/to/app/dev/index.js

    //= require "dev/a.js" 
    //= require "dev/b.js" 
$ jmen --file js/index.js --output web/compiled/main.js --compress

file: js/main.js

    //= require "a.js" 
    //= require "my/first.coffee" 
    // .... 

file: my/first.coffee

    #= require "second.coffee" 
    #  
    # other coffee code here 

The files structure looks like:

js/
  main.js
  a.js
  my/
    first.coffee
    second.coffee

Then, you can do it with jmen:

$ jmen --file js/main.js --output result.js
$ jmen -f less/index.scss -o css/app.css

file: less/index.scss

  //= header.less 
  //= bottom.less 
  // others ... 
$ jmen -f scss/index.scss -o css/app.css [-s /path/to/scss]

file: scss/index.scss

  //= header.scss 
  //= bottom.scss 
  // others ... 

Included files can be added onto top only !!!

If you just need to generate or compress your css/js files once, just do it with the --run-once(-r) option, e.g.:

$ jmen -f index.js -o compiled.js -c -r
$ jmen --help

0.4.0

Test

It's similar to the Ruby's sprockets (http://www.getsprockets.org) gem.