MENU

The Javascript and AngularJS build procedure

A Java developer we have the good habits to split the building process of a project in steps.In Javascript we use the same approach with some differences. An example of simplified build procedure:

Java build

Angular / Javascript build

code

code

compile

transpile

test

test

concatenate

minification

package

package

deploy

deploy

Differences between Java and Javascript1. In Java we compile, in Javascript we transpile. This step is needed only if you are not using the scripting language of the target platform. If you use TypeScript you need to convert your code in a code compatible with your target interpreter (i.e. ECMA5).

2. Concatenation: when an application is distributed is easier to manage only one file than dozens. The concatenation is used to merge multiple files in only one. This is similar to the concept of FatJar in Java.

3. Minification: the code file used in a JS project contains many useless characters (for the interpreter). The minification process try to optimize the code reducing the size of the JS file. In Java is the compile that optimize the code.

ToolsIn Java the common used tools for the building process are : maven, gradle and ant

In Javascript we can split this tools in 3 categories:Package manager to handle the dependencies: npm, bowerTask Runners: Grunt, Gulp.jsModule bundlers: WebPack