…do you build big code files, where great part of components are independent and You would like to keep em separate?
I roamed a bit around and I have found no solution fitting my needs: I had to build a 3kLines javascript file where too many elements are completely independent and I wanted to save’em in separate files, being able to write and test them in complete isolation.

Out there seem to exist only concatenation solutions, that from my point of view, sucks.

Using Nodejs I wrote a little script that allows to quickly get exactly what I needed.
That script became a module that can be installed through the node package manager executing

[sudo] npm install malta [-g] 


The project is hosted on github, the following sample is exactly the same that can be found on github.

javascript ?

My needs where only about javascript, in fact, Malta, thanks to a package called uglify-js, will generate even the minified version of the built file.

But Malta works great even with css, hmtl, txt, or other human-readable files.

minimal sample

Supposing in ~/myproject we have

|- a.js
|- inner/
   |- b.js

myfile.js :

Name : $name$
Author: $author$
Date: __DATE__
    var name = 'what';

src/a.js :

function hello(n) {
    alert('Hello ' + n);
hello('Federico'), hello('Federico');

src/inner/b.js :

hello = function () {
    alert('Hello again ' + n);

and least but not last vars.json :


Now from ~ execute:

 malta myproject/myfile.js myproject/out

in a while Malta will confirm the first creation of myproject/out/myfile.js and myproject/out/myfile.min.js.

From v. 1.0.17 on, is possible to start many builds at once executing:

 malta myconf.json

where myconf.json contains a key -> value for each build:

    "myproject/myfile.js" : "myproject/out",
    "myproject/src/style.less" : "media/style",

The myproject/out/myfile.js will look like:

Name : myFabulousProject
Author: Federico
Date: 11/9/2013
    var name = 'what';
    function hello(n) {
        alert('Hello ' + n);
        hello = function () {
            alert('Hello again ' + n);
    hello('Federico'), hello('Federico');

Let Malta run and try editing the myproject/myfile.js or the myproject/vars.json or one of the involved files, and get a look at the output folder content. To stop it use Ctrl + c

what`s new

The changelog can be found at All other information and code reside at the github project page.

enjoy Malta

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Posted in javascript, nodejs Tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see