+ 1

How to bundle multiple html elements into 1 index.html

How to bundle multiple html elements into 1 index.html

25th Nov 2020, 5:26 PM
Фидан Хайрутдинов
4 Respostas
+ 1
during development split the index.html structure into several html (header.html, main.html, footer.html). how, when building a project, to combine into one main.html
25th Nov 2020, 6:30 PM
Фидан Хайрутдинов
0
Use webpack with HtmlWebpackPlugin Eg. plugins: [ new HtmlWebpackPlugin({ template: './src/index.html', inject: true, chunks: ['index'], filename: 'index.html' }), new HtmlWebpackPlugin({ template: './src/about.html', inject: true, chunks: ['index'], filename: 'about.html' }), new HtmlWebpackPlugin({ template: './src/contacts.html', inject: true, chunks: ['index'], filename: 'contacts.html' }) ] This would reusing index.js file in every html page with chunks: [‘index’] This is not spa, since they are multiple html pages, you don't need to bundle them into one index.html.
17th Jan 2021, 8:20 AM
Calviղ
Calviղ - avatar