9

I'm using Webpack pug-html-loader + file-loader to generate a bunch of static pug templates.

I also want to start added hashed bundle filenames, but I cant work out how to insert the hashed filenames into all my pug templates

This is how I'm referencing my bundle currently in all the pug templates:

script(src="bundle.js")
link(href="bundle.css")

How would I modify that to reference bundle-[chunkhash].js/bundle-[chunkhash].css] - do I need to pass some variables to the pug-html-loader in webpack.config.js?

Note: I'm using the extract-text-plugin to output my SASS to a .css bundle file

chazsolo
  • 7,873
  • 1
  • 20
  • 44
Matthew
  • 952
  • 7
  • 20
  • I don't know what's the right way to solve your question. I normally use [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) to inject the script and css to my index.html file. It support custom template too – Bryan Chen Mar 07 '17 at 23:23
  • Ah, ye I looked at html-webpack but that doesnt seem to fit into the multiple pug template scenario I have going on. Thanks for the help though :) – Matthew Mar 08 '17 at 04:01

0 Answers0