Closed zjffun closed 3 years ago
"html-webpack-partials-plugin": "^0.7.0",
Reproduction:
index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <header> <h1>test</h1> </header> <header> <h1>test</h1> </header> </body> </html>
analytics.html
<div>HtmlWebpackPartialsPlugin test</div>
webpack config
plugins: [ new HtmlWebpackPlugin({ filename: 'index.html', template: path.resolve(__dirname, 'publish/index.html'), }), new HtmlWebpackPartialsPlugin([ { path: path.resolve(__dirname, 'publish/partials/analytics.html'), priority: 'high', location: 'head', }, ]), ],
result
<!doctype html> <html lang="en"> <head> <div>HtmlWebpackPartialsPlugin test</div> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Document</title> </head> <body> <head> <div>HtmlWebpackPartialsPlugin test</div> <h1>test</h1> <head> <div>HtmlWebpackPartialsPlugin test</div> <h1>test</h1> </head> </head> </body> </html>
A fix #35
published to v0.7.1
@all-contributors please add @zjffun for code
@colbyfayock
I've put up a pull request to add @zjffun! :tada:
Reproduction:
index.html
analytics.html
webpack config
result