0.1.2 • Published 9 years ago
ngtemplate-loader2 v0.1.2
AngularJS Template loader for webpack
Includes your AngularJS templates into your webpack Javascript Bundle. Pre-loads the AngularJS template cache to remove initial load times of templates.
Usage
require("!ngtemplate?module=myTemplates&relativeTo=/projects/test/app!html!file.html");
// => returns the javascript:
// angular.module('myTemplates').run(['$templateCache', function(c) { c.put('file.html', "<file.html processed by html-loader>") }]);
webpack config
It's recommended to adjust your webpack.config
so ngtemplate!html!
is applied automatically on all files ending on .html
:
module.exports = {
module: {
loaders: [
{
test: /\.html$/,
loader: "ngtemplate!html?module=myTemplates&relativeTo=" +
(path.resolve(__dirname, './app/'))
}
]
}
};
Then you only need to write: require("file.html")
.
Install
npm install ngtemplate-loader
License
0.1.2
9 years ago