Link Rel HTML Webpack Plugin
It allows you to modify the
title attribute on elements injected by HTML Webpack Plugin. This can be used to specify some stylesheets as
alternate stylesheets for accessibility or theming purposes. This is based on the
Link Media Webpack Plugin written by Evan Scott which lets
you modify the
media attribute in a similar fashion.
You must be running webpack on node 4.x or higher
Install the plugin with
$ npm install --save-dev link-rel-html-webpack-plugin
Load the plugin
const LinkRelHtmlWebpackPlugin = ;
When using Node 4.x or 5.x you don't have deconstruction assignment, instead use:
const LinkRelHtmlWebpackPlugin = LinkRelHtmlWebpackPlugin;
and add it to your webpack config as follows:
plugins:// ...files:file: /theme-default/ title: 'Default Theme'file: /theme-dark/ rel: 'alternate stylesheet' title: 'Dark Theme'// ...
You'll need to use this in conjunction with extract-text-webpack-plugin to create CSS stylesheets instead of JS modules for CSS resources.