About UnoCSS@0.65.0 upgrade introduction #4309
zyyv
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, Unoers!
We have released UnoCSS@0.65.0. This version includes bug fixes, new features, and optimizations. Here are the details of this update:
Async UnoCSS Engine
Starting from version 0.65.0, the UnoCSS engine is asynchronous from creation to parsing, greatly enhancing its extensibility.
#4268
new UnoGenerator
is deprecated and will throw an error if used ❌It is recommended to use
createGenerator
to create your UnoCSS engine.Thanks to the asynchronous engine, we now support asynchronous presets, which is a significant achievement 🚀. You can now use asynchronous functions in presets.
For example:
If you want to integrate an all-in-one preset, this asynchronous preset will be your best choice.
You can use the presets you need on demand, refer to the community preset unocss-preset-useful
Multiple Result Variant
Initially, this was to solve the
marker
andselection
variant issues, but due to the current design of variants, we needed to support multiple results for variants.So, in #4291, we made improvements, and now you can return multiple results in a variant.
This will generate:
In general, utilities come with multiple variants, but for multiple result variants, their parsing grows exponentially, which is very performance-consuming.
Therefore, we decided to ensure that the variant has
multiPass
disabled when using multiple result variants to prevent further parsing.Surprisingly, we found that it additionally supports a long-standing UnoCSS issue, which is an unexpected gain 🎉
Previously, in attribute mode, just like supporting
text="hover:blue"
being parsed ashover:text-blue
, when parsing variants,border="red:10"
would be parsed asred:border-10
because we were unsure of the variant's carrier.With support for multiple variant results, we will try to parse such cases and generate the correct results.
#4295
On-demand Preflights
During the years of UnoCSS, we heard user feedback and confusion about what this CSS is for. Even if I didn't use any of the CSS variables, it would still generate.
Preflights by default
This is due to the rules in
preset-uno
, which rely on these CSS variables. To correctly apply your styles, we need to generate these CSS variables in advance.But now!
In version 0.65.0, we support on-demand preflights. We have added dependencies on preflights to the rules in advance, and it will only generate the preflights that are needed.
#4252
Pre-parsing icon-set
preset-icons
will automatically detect the icon-set and automatically install the corresponding icon-set collection for you.But for custom icon-sets, it would also automatically detect them before, which was unnecessary. Therefore, in version 0.65.0, we added filtering for automatically detected icon-sets to exclude user-defined icon sets.
#4278
Layer CSS Order
If you enable the
outputCssLayers
option, the generated CSS will be sorted according to the order of the layers.In version 0.65.0, we will generate the layer sorting results at the top for you to view.
#4299
These are some of the main updates. For more updates, please check the CHANGELOG.
Thanks to antfu for providing endless possibilities for the upgrade and transformation of the engine, and to all the contributors to UnoCSS, thank you for your contributions!
Thank you for your attention to UnoCSS, have fun! 🎉
One more thing !
We plan to make unocss-community the official community of UnoCSS, where you can find more community presets and transformers.
Feel free to submit your presets and transformers to unocss-community organization, and we will help you promote them. Welcome to join us! 🚀
Beta Was this translation helpful? Give feedback.
All reactions