Skip to content

Commit f21d9c0

Browse files
Added example usage for extract-loader in combination with file-loader
1 parent a105a76 commit f21d9c0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,27 @@ module.exports = {
185185
};
186186
```
187187

188+
### Export into HTML files
189+
190+
A very common scenario is exporting the HTML into their own _.html_ file, to
191+
serve them directly instead of injecting with javascript. This can be achieved
192+
with a combination of 3 loaders:
193+
194+
- [file-loader](https://github.com/webpack/file-loader)
195+
- [extract-loader](https://github.com/peerigon/extract-loader)
196+
- html-loader
197+
198+
The html-loader will parse the URLs, require the images and everything you
199+
expect. The extract loader will parse the javascript back into a proper html
200+
file and the file loader will write the _.html_ file for you. Example:
201+
202+
```js
203+
{
204+
test: /\.html$/,
205+
loader: 'file-loader?name=[path][name].[ext]!extract-loader!html-loader'
206+
}
207+
```
208+
188209
<h2 align="center">Maintainers</h2>
189210

190211
<table>

0 commit comments

Comments
 (0)