AlbanilJS is more than a smart concatenator, it's a javascript builder. With AlbanilJS you can modularize your javscript projects using the RequireJS's syntax and then use these modules to build a standalone vendor-free javascript file (RequireJS independant!).
It works as a concatenator, taking the code of several javascripts files and creating a new one with all the chunks of code concateneted in some order. The special thing about AlbanilJS is that you have to use RequireJS modules as concatenation sources instead of using regular javascript files. This allows you to explicitly specify dependencies beteween the chunks of code you want to concatenate, which brings you awesome advatages. At compilation time, AlbanilJS will deal with the dependencies for you. So, for example, if you want to include an specific module in a build, you don't have to worry any more to also include before all the other modules of which the first one depends on. This is all resolved automagically! AlbanilJS will use the dependencies that you've specified and will write each module in the concatened file below the modules of which it depends on, so the javascript intepreter will always read the concatened code in the correct order.
At the end you will get a clean single javascript file, and when we say a clean, we really mean clean!. AlbanilJS will not add any vendor dependency to your code, your code will work as is (it won't need RequireJS to work). This happens because AlbanilJS will only take your code in each module and will ignore all the RequireJS syntactic ritual.
-
AlbanilJS allows you to modularize your code just as you would do with RequireJS. The thing is that, using AlbanilJS, you can build a standalone javascript file from these RequireJS modules, obtaining a single file wich doesn't need RequireJS to work.
-
With AlbanilJS you can make custom builds. For each build you can select the modules you want to include. AlbanilJS will create a final standalone javascript file with only the specified modules and its dependecies.
-
You don't have to worry to include manually all the modules' dependecies and the order in which you have to load them. This is all resolved automagically by AlbanilJS.
-
You can still use the RequireJS modules as RequireJS modules :P, by loading them directly using AMD. But don't forget, with AlbanilJS, you also have the choise to build an standalone javascript file which doesn't use RequireJS from those modules.
-
You can easily test each module separately by loading them using AMD.
It is avaible in npm
$ npm install -g albaniljs
It is very easy to use. A typical setup will involve adding only one file to your project: albanil.config.js. As you can see it's valid javascript file so it's completely programable, but this js has another important responsibility which is to configure your AlbanilJS builds. A typical albanil.config.js looks like:
//receives the albanil builder and the command line arguments passed to the albanil command
module.exports = function(albanil, args) {
//Do whatever you want here
albanil.build({
//Configuration object.
});
//Do whatever you want here
}
To build a javascript file you have to run the albanil command from the directory in which is located your albanil.config.js file. Is that easy!
For example, supose that you have created the albanil.config.js in the /a/b/c directory. Then you just should do:
$ cd /a/b/c
$ albanil
And that's all!
You can also require the albanil builder as a node module, and in the same manner as with the command line, you just need to pass the configuration to the builder.
var albanilBuilder = require('albanil');
albanilBuilder.build({
//Configuration object. It's the same as the specified in the albanil.config.js files!
})
The configuration object is a typical javascript object that looks like:
{
srcFolder: 'someFolder', //The path to the folder where your modules are located.
outFile: './out.js', //The path to the output file.
object: { //If you want to wrap your build in an object then use this option (optional).
name: 'ObjectName',
expositorModule: 'ModuleWhichExposesFunctionality'
},
include: [ //The modules that you want to include in this build.
'A/src/restCommunication/callXAPi',
'A/src/restCommunication/callYAPi'
]
}
Copyright (c) 2014 - 2014 Augusto Altman Quaranta [email protected] and Matias Carraza [email protected] et al Licensed under the MIT license.
If you any doubt, you want to contribute or you just want to meet us:
e-mail: [email protected], [email protected]