How to bundle multiple html elements into 1 index.html | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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
Š¤ŠøŠ“Š°Š½ Š„Š°Š¹Ń€ŃƒŃ‚Š“ŠøŠ½Š¾Š²
2 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