0.57.8 • Published 5 months ago

unocss-rspack-plugin v0.57.8

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

unocss-rspack-plugin

The Rspack plugin for UnoCSS.

Getting Started

To begin, you'll need to install unocss-rspack-plugin

npm install --save-dev unocss-rspack-plugin

yarn add -D unocss-rspack-plugin

yarn add -D unocss-rspack-plugin

rspack.config.js

const UnoCSS = require("unocss-rspack-plugin");

module.exports = {
  // ...
  plugins: [
    //...
    new UnoCSS(),
  ],
};

uno.config.js

https://unocss.dev/guide/config-file

// uno.config.ts
import { defineConfig } from "unocss";

export default defineConfig({
  // ...UnoCSS options
});

entry js

Add uno.css to your main entry:

import "uno.css";

For layers if you have

import "uno.css";
import "uno.utilities.css";
import "uno.components.css";

Options

For Rspack specific reasons, the concatenation of layers cannot use the official colon : , so the layerHyphen configuration is provided, which defaults to . , e.g. import "uno.mylayer.css".

I'm following this issue and will update when it's resolved.

interface Options {
  layerHyphen?: string;
}