UnoCSS is the instant atomic CSS engine, that is designed to be flexible and extensible. The core is un-opinionated, and all the CSS utilities are provided via presets.
You can integrate UnoCSS in Rsbuild via @unocss/webpack.
You need to install @unocss/webpack
first.
Register the UnoCSSRspackPlugin
plugin in tools.rspack:
You can add UnoCSS Presets via the options of UnoCSSRspackPlugin
, for example:
The above configuration is for reference only and can be modified to suit the needs of your project.
In the JavaScript entry file, import uno.css
:
You have now completed all the steps to integrate UnoCSS in Rsbuild!
You can use UnoCSS's utility classes in any component or HTML, such as:
For more usage details, refer to the UnoCSS documentation.
UnoCSS provides a VS Code Extension plugin for VS Code to decoration and tooltip for matched utilities.
You can install this plugin in VS Code to enable more intelligent features.