postcss-plugins icon indicating copy to clipboard operation
postcss-plugins copied to clipboard

Perf Section

Open Antonio-Laguna opened this issue 3 years ago • 1 comments
trafficstars

Antonio-Laguna avatar Jan 18 '22 10:01 Antonio-Laguna

I can help with this section.

We ❤️ Web Performance #cssPerf

nucliweb avatar Jan 18 '22 11:01 nucliweb

The main thing that could cause performance issues with postcss-preset-env is preserve: true.

Maybe we should just add a warning next to the plugin option info for preserve :

⚠️ setting preserve: true will cause a lot of duplication in your CSS files. The output will be more flexible and moderns browsers will use the more modern CSS. But a lot of intermediate CSS will be generated aswel.

It is best to not set preserve and to rely on the default for each plugin individually.

romainmenke avatar Jan 29 '23 12:01 romainmenke

I am closing this because it has not had any progress in a while :)


Personally I also think it is tricky to give performance advice for CSS authors from the perspective of PostCSS plugins that provide fallbacks for native features.

Most often changes CSS authors make to either tooling or their source code will not dramatically improve a specific website's performance and when it does it is most likely because of a very specific issue that was resolved.

The things we create here will almost always bloat CSS bundles and will have some negative performance impact. But this is done to improve support for older browser versions. Being a source of negative performance impact makes it awkward to give performance advice.

We try to be mindful of our performance impact and over the past ±2 years we have dramatically reduced the output size for users of postcss-preset-env.

I think this work is more valuable than adding a section with performance related advice on channels that are focussed on postcss-preset-env. Even if that means that this work will be largely invisible.


I am fine with revisiting this if someone does want to invest time in this :)

romainmenke avatar Oct 10 '23 21:10 romainmenke