CLI tool to pre-cache HTML templates into AngularJS $templateCache, reducing HTTP requests. Version 1.3.3 is the latest stable release (last updated 2016-03-09). It supports glob patterns, HTML minification (via html-minifier), custom output, base path stripping, and configurable module naming. Differentiators include TypeScript support, multiple module styles (browser, browserify, ES2015), and the ability to ignore missing files. This project is in maintenance mode and not compatible with Angular (2+).
npm install angular-template-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Generates an AngularJS module that pre-caches all HTML templates using $templateCache. Run CLI with glob pattern and output file, then include the generated file in your app.
Always quote the pattern: -f 'src/**/*.html'
Use -m to specify a custom module name, or use --no-new-module if the module is already defined elsewhere.
Disable minification with --no-html-min or fine-tune html-minifier options with --htmlmin-* flags.
Provide --style browserify if you need CommonJS require syntax.
Use callback pattern: const ngHtml2Js = require('angular-template-cache'); ngHtml2Js(options, callback);Install as devDependency: npm install angular-template-cache --save-dev
Use npx nghtml2js or node_modules/.bin/nghtml2js
Ensure angular.js is included before the generated template file.