0.1.2 • Published 11 years ago
freemason v0.1.2
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:
bufferis used by all tasks implicitly, to store the state of your build.taskscontains all the default tasks (currentlyconcatenate,minify,attribute, andwrite).queueTaskmust be used to run a task synchronously, and all calls toqueueTaskmust 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.taskDonemust be called when the task is complete, in order to move on to the next task.