This package has been deprecated

Author message:

There are many problems in this unocss-preset-uni and may not be maintained in the future. Please consider using unocss-applet.

unocss-preset-uni
TypeScript icon, indicating that this package has built-in type declarations

0.1.9 • Public • Published

unocss-preset-uni

Version Downloads

The UniApp preset for UnoCSS, fork from @unocss/preset-uno and modified to transform some CSS selector that mini-program can't use.

Installation

npm i unocss-preset-uni unocss --save-dev # with npm
yarn add unocss-preset-uni unocss -D # with yarn
pnpm add unocss-preset-uni unocss -D # with pnpm
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Unocss from 'unocss/vite'
import { presetIcons } from 'unocss'

import { presetUni } from 'unocss-preset-uni'
import { UnoCSSToUni } from 'unocss-preset-uni/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Unocss({
      presets: [
        // presetUno(),
        presetUni(),
        presetIcons(),
      ],
    }),
    // Make sure it's behind Unocss()
    UnoCSSToUni(),
  ],
})

Change

CSS selector transform

form to sample
*,::before,::after page,::before,::after -
\. -point- p-0.5 -> p-0-point-5
\/ -div- p-1/2 -> p-1-div-2
\: -c- dark:text-green-500 -> dark-c-text-green-500
\% -pct opacity-10% -> opacity-10-pct
\! i- !bg-black -> i-bg-black
\# -h- bg-#121212 -> bg--h-121212
\( p- bg-[hsl(2.7,81.9%,69.6%)] -> bg-[hslp-2.7,81.9%,69.6%)]
\) -q bg-[hsl(2.7,81.9%,69.6%)] -> bg-[hsl(2.7,81.9%,69.6%-q]
\[ l- bg-[hsl(2.7,81.9%,69.6%)] -> bg-l-hsl(2.7,81.9%,69.6%)]
\] -r bg-[hsl(2.7,81.9%,69.6%)] -> bg-[hsl(2.7,81.9%,69.6%)-r
\, -comma- bg-[hsl(2.7,81.9%,69.6%)] -> bg-[hsl(2.7-comma-81.9%-comma-69.6%)]

License

MIT License © 2022-PRESENT Neil Lee

Package Sidebar

Install

npm i unocss-preset-uni

Weekly Downloads

8

Version

0.1.9

License

MIT

Unpacked Size

19 kB

Total Files

22

Last publish

Collaborators

  • zguolee