New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lower modern yet 12 y.o. CSS properties and values to vendor-prefixed versions #3122
Comments
(As a little addendum: |
I would also like to see this feature. I see it as a missing feature, because I expect my build system to transpile my CSS into being brower-compatible (based on the browser target list), just as it's done for JavaScript. Currently I'm hacking around this by using PostCSS as a post-build step, but PostCSS is insanely slow. Even just |
I've added some vendor prefixing to esbuild. Here's the current list of automatically-prefixed properties:
Compatibility data has been copied from https://caniuse.com. This should get things started, and support for more CSS properties can be added in the future as appropriate. Hopefully all of these transformations were done correctly. I tested some of them but not all of them. I know of a few special cases (e.g. |
Thanks! It's so awesome to see this feature implemented that quickly ✨ |
This is great! 🥳 It may be worth looking at Autoprefixer as a reference for all the different properties that people expect, since that project has years of history and development for this exact purpose: https://github.com/postcss/autoprefixer/blob/main/data/prefixes.js |
Is there an opt-out option to this? |
If you don't set the target environment, then esbuild won't add any prefixes. |
If I just set a JS-only target like |
No, only browser targets apply to CSS. Other non-browser targets such as |
Vendor-prefixing is a deprecated practice that seems to be on the decline, yet this article on CSS-Tricks "Is Vendor-Prefixing dead?" counted 31 "features" that still required prefixing in 2021.
Some of those features, like the
mask-image
properties, are quite commonly used on the web and are available to web authors for more than 12 years. In thismask-image
example, Chrome doesn't seems to have short term plans to get rid of those prefixes (it doesn't seems to be part of Interop 2023), so it will be needed for years to come.Prefixes are cumbersome to add manually — but it is quite cumbersome to automate their additions in a
esbuild
-based toolchain too, as it means installing PostCSS packages and load a PostCSS plugin inesbuild
solely to useautoprefixer
.Vendor-prefixing doesn’t seems to be a moving target anymore, and will be required for years to come. Having a way to use the recent
target
/supported
options to handle those properties and values, at least the few that only needs a prefix (without more syntax changes), would save developers hours of work and megabytes of toolchains to download! ✨The text was updated successfully, but these errors were encountered: