bridgetown icon indicating copy to clipboard operation
bridgetown copied to clipboard

PostCSS config: turn autoprefixer off by default?

Open jaredcwhite opened this issue 2 years ago • 5 comments

I'm increasingly wary of defaults that account for years-old browsers as they result in ~~significant~~ size/performance penalties of built assets. Just one example: when autoprefixer is enabled and you add @keyframes animations to your CSS, every single one gets duplicated with @-webkit-keyframes…yet Safari hasn't needed that since early 2016!

I'd like to look at either turning it off completely by default (aka you'll need to opt-in), or figure out some kind of browserslist default that's more reasonable.

I'm weighing bumping up the default PostCSS stage as well back up to 4 which is what I prefer to use (e.g. I don't want all my CSS variables polyfilled, resulting in massive duplication), but if so I'll file a separate issue.

jaredcwhite avatar Jan 10 '22 23:01 jaredcwhite

Actually with gzip compression etc., it doesn't seem to make too much of a difference either way. 8.79kB vs 9.06kB 🤷‍♂️

jaredcwhite avatar Jan 10 '22 23:01 jaredcwhite

you could set browserlists in package.json to be last 1 version which may help but if you do I'd suggest adding their upgrade command to the package.json scripts.

npx browserslist@latest --update-db

the why↗️

andrewmcodes avatar Jan 14 '22 18:01 andrewmcodes

@andrewmcodes thanks I'll check that out.

jaredcwhite avatar Jan 15 '22 17:01 jaredcwhite

Yes, as an example, Ember uses a config/targets.js file (https://cli.emberjs.com/release/advanced-use/asset-compilation/#jstranspiling), where the project can configure supported browsers. This data is then consumed by CSS and JS pre-processors. Also based on browserlist, which was mentioned above.

Maybe Bridge Town could do something in that direction?

sandstrom avatar Jul 28 '22 23:07 sandstrom

Appreciate the additional reference there @sandstrom

jaredcwhite avatar Jul 29 '22 20:07 jaredcwhite

This seems too low of a priority at this point. I'd rather prioritize making PostCSS optional anyway as time goes by…

jaredcwhite avatar Jun 19 '23 05:06 jaredcwhite

@jaredcwhite Great that you are simply closing low-priority issues.

Makes the set of actual issues more manageable, and also reflects the reality that there will always be more wishes than time.

More open-source maintainers should do like this! 💯

sandstrom avatar Jun 19 '23 07:06 sandstrom