freemason
v0.1.2
Published
Free-form build automation
Downloads
2
Maintainers
Readme
freemason
A simple way to bundle, minify, and attribute JavaScript packages. No configuration required!
Here is an example of a build file (let's name it build.js
):
var build = require('freemason').tasks;
build.concatenate('sourcefile1.js','sourcefile2.js');
build.minify();
build.attribute('src/credits.txt');
build.write('dist/bundle.min.js');
To build, just run node build.js
. That's it! This is all you need to do in order to concatenated a bunch of files, minify/obfuscate the result, put some credits on top, and write it to a file.
Want to write your own tasks? There are only four conventions to keep in mind:
buffer
is used by all tasks implicitly, to store the state of your build.tasks
contains all the default tasks (currentlyconcatenate
,minify
,attribute
, andwrite
).queueTask
must be used to run a task synchronously, and all calls toqueueTask
must be made within the first execution loop. Don't queue tasks on asynchronous callbacks -- it won't work. Instead, build any asynchronous functionality into the task definition.taskDone
must be called when the task is complete, in order to move on to the next task.