17 private links
I work on a lot of Javascript projects. The fashion in Javascript is to use build tools like Gulp or Webpack that are written and configured in Javascript. I want to talk about the merits of Make (specifically GNU Make).
Make is a general-purpose build tool that has been improved upon and refined continuously since its introduction over forty years ago. Make is great at expressing build steps concisely and is not specific to Javascript projects. It is very good at incremental builds, which can save a lot of time when you rebuild after changing one or two files in a large project.
Make has been around long enough to have solved problems that newer build tools are only now discovering for themselves.
Despite the title of this post, Make is still widely used. But I think that it is underrepresented in Javascript development. You are more likely to see a Makefile in a C or C++ project, for example.
My guess is that a large portion of the Javascript community did not come from a background of Unix programming, and never had a good opportunity to learn what Make is capable of.
I want to provide a quick primer here; I will go over the contents of the Makefile that I use with my own Javascript projects.
Gulp est un "Automatiseur de tâches", un task runner comme disent nos amis anglophones, c'est à dire qu'il est capable de lancer des bouts de scripts à votre place tout seul comme un grand.
Ces tâches dépendent de votre bon vouloir et peuvent être très variées :
- des opérations simples telles que minifier ou concaténer du CSS ou du JavaScript,
- la création ou la suppression de dossiers ou de fichiers (possibilité de créer un projet à partir de zéro),
- l'optimisation, la compression d'images,
- la création de serveur local permettant de tester sur de multiples périphériques en même temps,
- la simulation de navigateurs fantômes conçus pour parcourir et tester les regressions d'affichage d'une page,
- etc.