To inject link element into html template
This is a plugin for html-webpack-plugin. The plugin insert html link tag into a html which html-webpack-plugin uses.
Here is webpack.config.js
const htmlLinkInjection =const HtmlWebpackPlugin =// I use to load some css files in webpack config entries.// You don't have to import this if you use just the 'html-link-injection'.const MiniCssExtractPlugin =const config =context: __dirnamemode: 'development'entry:'./data/index.js''./data/index.css'// this entry is processed by html-webpack-plugin and mini-extract-plugin.output:path: __dirnamefilename: 'bundle.js'plugins:link:href: 'main.css'// this is processed by html-link-injection.module:rules:test: /\.css$/use:loader: MiniCssExtractPluginloader'css-loader'moduleexport = config
This is the conten of 'index.html' which is genenrated by html-webpack-plugin.