-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature request
What is motivation or use case for adding/changing the behavior?
I am using inline JS and CSS for some main pages. Currently, if i'm not mistaken, there is no way to set different rules for different entries. My project has both HTML pages with inline JS/CSS and pages without inline code. I saw the EntryDescription in the documentation, but it only has a data key for passing variables.
Describe the solution you'd like
It would be very helpful to change the minify, js, or css inline settings, etc. for each entry. For example:
new HtmlWebpackBundlerPlugin({
entry: {
'index': 'src/views/index.pug', // default
'music/index': {
import: 'src/views/info/index.pug',
data: { info: 'some info' },
minify: {
minifyCSS: true,
minifyJS: true,
},
js: { inline: true },
css: { inline: true },
},
...other_templates
},
js: { inline: false },
css: { inline: false },
preprocessor: 'pug',
method: 'render',
loaderOptions: {
sources: [
{ tag: 'img', attributes: ['data-src', 'data-srcset'], },
{ tag: 'video', attributes: ['data-src'], },
],
},
preprocessorOptions: {
filters: { 'markdown': require('./filters/md2html.js'), }
},
minify: {
collapseWhitespace: true,
keepClosingSlash: true,
removeComments: true,
removeRedundantAttributes: false,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
},
// ...
})Describe alternatives you've considered
- I tried creating multiple plugin instances (even though it's not meant for that)
- I tried using multiple PugPlugin instances
- I tried using multiple HtmlWebpackPlugin instances (too complex, and it's hard to make all features work)
- Almost accepted that I would have to manually delete js css files after the build and inline them manually.
Appreciation for the useful project
Thank you for your plugins and your previous help. I enjoy using them because they are simple, comfortable, and have many features.
- After the feature is implemented, do not forget to give a star ⭐
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request