Chapter 32. More Tools
Module systems and package managers are covered in Chapter 31. But there are additional important categories of tools:
- Linting
Lint tools analyze source code and report potential problems and style violations. Three popular ones are:
- Unit testing
Ideally, a unit test framework runs on both of the two large JavaScript platforms—the browser and Node.js. Two important frameworks that do are:
- Minification
JavaScript source code usually wastes space—variable names are longer than need be, there are comments, extra whitespace, and so on. A minification tool removes the waste and compiles code to smaller code. Some parts of the removal process are relatively complex (e.g., the renaming of variables to short names). Three popular minification tools are:
- Building
- For most projects, there are many operations that you need to apply to their artifacts: lint the code, compile code (compilation happens even in web projects—for example, to compile a CSS language such as LESS or Sass to plain CSS), minify code, and more. Build tools help you do that. Two classic examples are make for Unix and Ant for Java. Two popular build tools for JavaScript are Grunt and Gulp. One of their most intriguing features is that you can stay in JavaScript while working with them; they are both based on Node.js.
- Scaffolding
- A scaffolding tool sets up an empty project, preconfigures build files, and more. Yo is one such tool. It is part of the Yeoman suite of tools for web development, which bundles yo, Bower, and Grunt.
Get Speaking JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.