You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got some fairly complicated CSS overlays that end up in various parts of the DOM. In low resource environments, the repetitive/recursive application of these styles can become a bit bloated on a page. This is compounded by the comments left in the DOM from the original CSS. I'd request that the application default behavior is to strip comments and lexicographically condense the CSS when injecting into the DOM for faster parsing. This might be a marginal gain in most settings, but I believe in making good use of comments as these living documents are modified, and that seems opposed to the implementation strategy which allows all those useless bytes to remain recursively embedded in the live page. Over time, it does seem to cause some noticeable performance delays. Perhaps a setting would allow the purists to prevent contraction before injection? But I don't see any reason to allow comments and extra whitespace for that matter to be embedded after the injector knows what to put where.
Stripping of comments and whitespace in JS sounds like a much more expensive operation than doing it in the optimized native machine code inside the browser. Naturally, there may be a bug in the browser, but that should be reported and fixed, and the first step would be to verify there's a detectable difference by comparing results in devtools -> performance for your CSS's original vs minified state.
One possible implementation I can agree with at this point would be a [ ] minify injected CSS for performance gains option that stores the minified CSS inside the style database when a style is edited/updated. It would naturally nearly double the disk space for the database, but that's the user's decision to make.
Yes I hear you — and your second comment quite well captures what I had in mind. Doing it once upon saving is a small task vs doing it in real time multiplied by hundreds or thousands of recursions on a page that’s actively mutated would be favorable no matter how fast the browser can get the job done over JS, IMO. (Highly mutated pages are what drive the consideration, mainly.) Disk space expense is a reasonable consideration, but also a minimal expense given the typical scenario. User option is good. Thanks for your thoughts! :)
I'd request that the application default behavior is to strip comments and lexicographically condense the CSS when injecting into the DOM for faster parsing.
If I understand what you mean, provided preprocessors can do this already. I use Stylus Lang and final <style> injected element doesn't contain any comments. However, it still requires resources to process code and remove all comment lines. I'm not sure if it happens on page load and change of style settings only, or if there're more conditions for it.
Preprocessors are called when changing the text of the style or its config and the result is cached in sections of the style object in storage.
Good to know. When does the cache storage reset, if it does? Like closing the browser, etc.
I was afraid of bloating the style size and overusing preprocessor functions because of the possible performance hit or page load slowdown, but if you say so, it shouldn't really be a problem.
By the way, automatic style minification might be a thing, but I'm not sure if there would be a real benefit from it, like faster style parsing by a browser or style injection speed.
It's a permanent part of the style object in storage, currently there's no functionality to evict it because the database is usually just a few megabytes.
Activity
tophf commentedon Dec 1, 2025
Stripping of comments and whitespace in JS sounds like a much more expensive operation than doing it in the optimized native machine code inside the browser. Naturally, there may be a bug in the browser, but that should be reported and fixed, and the first step would be to verify there's a detectable difference by comparing results in devtools -> performance for your CSS's original vs minified state.
tophf commentedon Dec 1, 2025
One possible implementation I can agree with at this point would be a
[ ] minify injected CSS for performance gainsoption that stores the minified CSS inside the style database when a style is edited/updated. It would naturally nearly double the disk space for the database, but that's the user's decision to make.whi7ed3vil commentedon Dec 1, 2025
Yes I hear you — and your second comment quite well captures what I had in mind. Doing it once upon saving is a small task vs doing it in real time multiplied by hundreds or thousands of recursions on a page that’s actively mutated would be favorable no matter how fast the browser can get the job done over JS, IMO. (Highly mutated pages are what drive the consideration, mainly.) Disk space expense is a reasonable consideration, but also a minimal expense given the typical scenario. User option is good. Thanks for your thoughts! :)
Desynci commentedon Mar 16, 2026
If I understand what you mean, provided preprocessors can do this already. I use Stylus Lang and final <style> injected element doesn't contain any comments. However, it still requires resources to process code and remove all comment lines. I'm not sure if it happens on page load and change of style settings only, or if there're more conditions for it.
tophf commentedon Mar 17, 2026
Preprocessors are called when changing the text of the style or its config and the result is cached in
sectionsof the style object in storage.Desynci commentedon Mar 19, 2026
Good to know. When does the cache storage reset, if it does? Like closing the browser, etc.
I was afraid of bloating the style size and overusing preprocessor functions because of the possible performance hit or page load slowdown, but if you say so, it shouldn't really be a problem.
By the way, automatic style minification might be a thing, but I'm not sure if there would be a real benefit from it, like faster style parsing by a browser or style injection speed.
tophf commentedon Mar 19, 2026
It's a permanent part of the style object in storage, currently there's no functionality to evict it because the database is usually just a few megabytes.