Modularizing templates
Until now, templates have been declared as script tags in the index.html file. While this is a good approach for small projects, it is not a good idea to put all your templates directly in the HTML file.
With Browserify, you can extract all your template files into individual files, with the advantage of modularization and a cleaner index.html file. Another benefit of modularizing templates is that you can pre-compile all the templates, saving resources in your users' browsers.
With Browserify, you can modularize almost any template format: jade, Handlebars, Underscore, and so on. It uses a transformation process described in Figure 4.5. If you have worked with other bundler tools such as webpack, transformations are analogous ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access