From 19f0eeb0d279d7a50782e47601cb977c0e77a329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Steunou?= Date: Fri, 19 Feb 2016 10:54:27 +0100 Subject: [PATCH] Explicit documentation about sub-templating Maybe I should split this PR into 2 commits, you will tell me * there was one comma `;` in the example that made my build crash. * judging by the hard time people have when using this feature, including myself, there is clearly some miss-understanding #230 #202 #198 #176 --- migration.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/migration.md b/migration.md index c61f2ea..22b4433 100644 --- a/migration.md +++ b/migration.md @@ -72,13 +72,30 @@ This also removes the `o` in template variables. ` -<%= require('partial.html'); %> +<%= require('partial.html') %> ``` +For the above example you would have to configure a [html](https://github.com/webpack/html-loader) and url/[file-loader](https://github.com/webpack/file-loader): + +```js +module: { + loaders: [ + {test: /\.png$/, loader: "file-loader"}, + { + test: /\.html$/, + exclude: /index.html$/, // you need to exclude your base template (unless you do not want this plugin own templating feature) + loader: "html" + } + ] +} +``` + +This configuration allows you to require partial html from your main `index.html` without being itself parsed by the html-loader instead of this html-webpack-plugin. + + ## Custom template engines Maybe you prefer jade or blueimp over underscore - or your project is using jade for the front end part.