-
Notifications
You must be signed in to change notification settings - Fork 36
Enable/disable per entry #106
Comments
It's all or nothing right now. I could accept a PR changing this if you can propose good semantics on how to handle it. |
Maybe: new PurifyCSSPlugin({
// Default settings for all processed css files
styleExtensions: ['.css'],
moduleExtensions: ['.html'],
minimize: false,
paths: glob.sync(path.join(__dirname, 'app/*.html')),
purifyOptions: {
whitelist: ['debug', 'blink']
},
verbose: true,
// Add global disable switch
disable: true,
// For each entry you may supply custom settings
// that are merged over the global defaults.
entry: {
[entryName]: {
disable: false, // active here
moduleExtensions: ['.js'],
paths: glob.sync(path.join(__dirname, 'react/*')),
purifyOptions: {
whitelist: ['wf-active']
}
},
// etc for further entries...
}
}); I think that reads clearly. I would know fairly quickly how to use it. What do you think ? I would have to go learn that json schema, but it doesn't look too complicated. |
I would drop the global I wonder if we could do some kind of a I'll try to get more input on this issue so we get the design right. |
Global - new PurifyCSS() The per |
It's actually done already. What we would do here is to make the behavior more granular. The more I think about it, the more a good |
Do you mean include [entryName,...] ? I find that when there are multiple entries that they are all substantially different. |
@crucialfelix Yeah, that would be a start. |
I still think a disable switch is very useful. It's easy to disable for all and then enable for the few or the one. Or enable for all and just disable one. In development I would disable it; maybe I'm using tachyons and I want all those classes available in my browser to experiment with. In production the unused ones get stripped.
I'm not familiar with any that use The implementation for how I described it above would actually be really easy. Only a few lines of code.
options per entry is essentially just:
(rough sketch. options should be merged without .entry etc.) As I mentioned yesterday, when I have multiple entries then for purifycss they would each have completely different parameters. Different templates/js to scan, different white lists. eg.
I'm happy to put together a PR with whatever the consensus is. |
The point was that it's possible to achieve the same result globally without touching the plugin. That's how everything else works in webpack ecosystem. I think we should refactor possible Please set up a prototype based on |
Sorry, you've totally lost me. Where is this This relates to rules, but from reading this I have no idea what it is actually for: https://webpack.js.org/configuration/module/#rule-include I can find this:
https://webpack.js.org/concepts/output/#output-devtoollinetoline But I don't see how this relates to configuring a plugin. If you say that "the same result can be achieved globally without touching the plugin", then I'm not sure what you are proposing to do to this plugin. Sorry, I don't understand the proposal. |
There's a piece like The interface could look like |
Any update on this? It would be great if there was any way at all to match entry/split points to paths. A lot of treeshaking can be done with CSS modules, but if you're not generating your HTML via JS, that's not an option, and something like this would be great. For my use case, even if we could just refer to the chunk name in the path declaration or something it could work. |
purifycss-webpack@0.6.2
I see that there is a way to provide different paths per entry, but I need to completely disable purifycss for some entries.
I have an angular-js app that cannot be read by purifycss. I only want to run purifycss on one entry.
Is there a way to do this that I've missed ?
Thanks.
The text was updated successfully, but these errors were encountered: