Compiler
With this you can create files on fly or compile coffee to javascript files. The word can multiple meanings:
- Compile ja(h) - like we say in my country to "Compile now"
First intended to my own projects, but it help me to compile multiple coffee-script sources in javascript files.
Install
$ npm install jah-compiler
Usage
Thought to be used in Cakefiles, jah-compiler see for files in src/ folder; these files, at this momoment, must have .coffee files; this module use coffee-script-redux to do the compilation process, and specfolder to parse a mapping the filenames in src/ folder:
The code is very simple, call jah-compiler with a callback that shows the generated javascript data:
compile = require 'jah-compiler' task 'build', 'rebuild the custom src files in src/ folder', (options) -> compile (javascriptdata) -> console.log javascriptdata console.log "DONE"
- ./src/somefile.coffee => ./lib/somefile.js
- ./src/somefile.test.coffee => ./test/somefile.js
- ./src/somefile.examples.coffee => ./examples/somefile.js
- ./src/somefile.somefolder.another.coffee => ./somefolder/another/somefile.js
Test and build
Clone the project and run tests:
$ git clone https://github.com/jahpd/compiler.git
$ npm test
you will see this:
src: 'src/compiler.coffee' dest: 'lib/compiler.js' src: 'src/compiler.test.coffee' dest: 'test/compiler.js' src: 'src/g.test.coffee' dest: 'test/g.js' DONE DONE DONE