diff --git a/README.md b/README.md
index 5171322..ab84818 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ HTML Webpack Plugin
This is a [webpack](http://webpack.github.io/) plugin that simplifies creation of HTML files to serve your
webpack bundles. This is especially useful for webpack bundles that include
a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you or supply
-your own template (using [blueimp templates](https://github.com/blueimp/JavaScript-Templates)).
+your own template (using lodash/ejs templates.
Installation
------------
@@ -70,7 +70,7 @@ Allowed values are as follows:
- `hash`: `true | false` if `true` then append a unique webpack compilation hash to all
included scripts and css files. This is useful for cache busting.
- `chunks`: Allows you to add only some chunks (e.g. only the unit-test chunk)
-- `excludeChunks`: Allows you to skip some chunks (e.g. don't add the unit-test chunk)
+- `excludeChunks`: Allows you to skip some chunks (e.g. don't add the unit-test chunk)
Here's an example webpack config illustrating how to use these options:
```javascript
@@ -121,7 +121,7 @@ and favicon files into the markup.
```javascript
plugins: [
new HtmlWebpackPlugin({
- title: 'Custom template',
+ title: 'Custom template',
template: 'my-index.html', // Load a custom template
inject: 'body' // Inject all scripts into the body
})
@@ -135,7 +135,7 @@ plugins: [
- {%=o.htmlWebpackPlugin.options.title}
+ <%= htmlWebpackPlugin.options.title %>
@@ -153,7 +153,7 @@ plugins: [
]
```
-You can use the [blueimp template](https://github.com/blueimp/JavaScript-Templates) syntax out of the box.
+You can use the lodash/ejs syntax out of the box.
If the `inject` feature doesn't fit your needs and you want full control over the asset placement use the [default template](https://github.com/ampedandwired/html-webpack-plugin/blob/master/default_index.html)
as a starting point for writing your own.
diff --git a/default_index.html b/default_index.html
index 5ba181b..f9466a4 100644
--- a/default_index.html
+++ b/default_index.html
@@ -2,7 +2,7 @@
- {%=o.htmlWebpackPlugin.options.title %}
+ <%= htmlWebpackPlugin.options.title %>
diff --git a/index.js b/index.js
index dc15e57..ccca5c9 100644
--- a/index.js
+++ b/index.js
@@ -27,7 +27,7 @@ function HtmlWebpackPlugin(options) {
}, options);
// If the template doesn't use a loader use the blueimp template loader
if(this.options.template.indexOf('!') === -1) {
- this.options.template = 'blueimp-tmpl!' + path.resolve(this.options.template);
+ this.options.template = require.resolve('./loader.js') + '!' + path.resolve(this.options.template);
}
// Resolve template path
this.options.template = this.options.template.replace(
@@ -302,7 +302,7 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function(compilation, chun
// Use the configured public path or build a relative path
var publicPath = typeof compilation.options.output.publicPath !== 'undefined' ?
- compilation.options.output.publicPath :
+ compilation.options.output.publicPath :
path.relative(path.dirname(self.options.filename), '.');
if (publicPath.length && publicPath.substr(-1, 1) !== '/') {
diff --git a/loader.js b/loader.js
new file mode 100644
index 0000000..64fc5ab
--- /dev/null
+++ b/loader.js
@@ -0,0 +1,20 @@
+var _ = require('lodash');
+var loaderUtils = require('loader-utils');
+
+module.exports = function (source) {
+ 'use strict';
+ var allLoadersButThisOne = this.loaders.filter(function(loader) {
+ return loader.module !== module.exports;
+ });
+ // This loader shouldn't kick in if there is any other loader
+ if (allLoadersButThisOne.length > 0) {
+ return source;
+ }
+ // Use underscore for a minimalistic loader
+ if (this.cacheable) {
+ this.cacheable();
+ }
+ var options = loaderUtils.parseQuery(this.query);
+ var template = _.template(source, options);
+ return 'module.exports = ' + template;
+};
\ No newline at end of file
diff --git a/package.json b/package.json
index 2cd9c97..6fbd843 100644
--- a/package.json
+++ b/package.json
@@ -42,9 +42,8 @@
},
"dependencies": {
"bluebird": "^2.9.25",
- "blueimp-tmpl": "^2.5.4",
- "blueimp-tmpl-loader": "0.0.3",
"html-minifier": "^0.7.2",
+ "loader-utils": "^0.2.10",
"lodash": "~3.9.3",
"raw-loader": "^0.5.1"
}
diff --git a/spec/fixtures/webpackconfig.html b/spec/fixtures/webpackconfig.html
index 122c9b5..8bc4abe 100644
--- a/spec/fixtures/webpackconfig.html
+++ b/spec/fixtures/webpackconfig.html
@@ -5,7 +5,7 @@
Test
- Public path is {%=o.webpackConfig.output.publicPath%}
-
+ Public path is <%= webpackConfig.output.publicPath %>
+