Matthew
Matthew

Reputation: 962

Webpack 2 - file-loader [path] options

Im using webpacks file-loader to output a bunch of compiled html files from a folder of pug templates.

I want to put the html files in the output directory, into the same folder structure they were in when they were in the source /pug/ folder, minus the pug folder itself.

For example if in the /pug/ folder, one of the files was /pug/layouts/index.pug, and another was in /pug/templates/main/index.pug, Im trying to make the outputted html files be sent to /dist/layouts/index.html and /dist/templates/main/index.html

Im using file-loader?name=[path][name].html but that results in files such as /dist/pug/layouts/index.html - note the pug folder. I cant work out how to get rid of it, any ideas?

Upvotes: 0

Views: 676

Answers (1)

Matthew
Matthew

Reputation: 962

Turns out the file-loader accepts a context=./path query parameter

So this works "file-loader?name=[path][name].html&context=./pug"

Upvotes: 1

Related Questions