Mini-css-extract-plugin - how grap the hash naming on index.html

I try currently to implement mini-css-extract-plugin.

I fail to implement hash naming, when I use it I don’t know how lead my index.html file to grap the specific name on the fly.

If someone has any idea would be great.Thanks

Here my webpack.config.js :

plugins:[newMiniCssExtractPlugin({// Options similar to the same options in webpackOptions.output// both options are optional filename:'styles.[contenthash].css'})],module:{ rules:[{ test:/\.js|jsx$/, exclude:/node\_modules/, include: path.resolve(\_\_dirname,"src"),use:[{ loader:"babel-loader", options:{ presets:["es2015","stage-1","react"]}}]},{ test:/\.css$/,use:[{ loader:MiniCssExtractPlugin.loader, options:{ publicPath:"./public"}},{ loader:"css-loader"}]}]},

here my index.html:


how translate in my html the “[contenthash]” part of my css filename in order to grap the css filename ?

1 Like