6

The Javascript and AngularJS build procedure

 3 years ago
source link: https://marco.dev/2016/10/05/the-angularjs-build-procedure/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

java-version.com: What's new in Java 16? 15? Keep up to date!

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 Javascript
1. 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.

Tools
In 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, bower
Task Runners: Grunt, Gulp.js
Module bundlers: WebPack

Author

Marco Molteni

Marco Molteni Blog


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK