- Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
I have tested out a hook (see link to patch below) that's logically something like shouldDropCSSRule(kind,selector). Testing it out on a real site using the NPM provided Bootstrap and build it with ESBuild with and without tree shaking (verified visually and with a Chrome diff extension):
| Options | Output size |
|---|---|
| Default | 280 KB |
| Default gzipped | 34 KB |
| Default minified | 230 KB |
| Default minified gzipped | 31 KB |
| Treeshaken | 33 KB |
| Treeshaken gzipped | 6.5 KB |
| Treeshaken minified | 29 KB |
| Treeshaken minified gzipped | 6.2 KB |
I understand that this may be a hard sell, but those who don't try never win, and: 1. This should be useful to many and 2. In my head this strikes a good balance of not exposing too much internals.
Note that the code linked to below is mostly written by Claude Code for demo purposes to see how viable this approach would be, but feel free to use it as you please:
- The ESBuild hook: https://github.com/bep/esbuild/tree/poc-cssfilter
- The integration with the above hook on the Hugo side: https://github.com/bep/esbuild/tree/poc-cssfilter
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels