Skip to content

Commit

Permalink
perf: ✨ 使用 @uni-helper/unocss-preset-uni
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Feb 20, 2024
1 parent 8b37bce commit 705c794
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"eslint.experimental.useFlatConfig": true,

// Disable the default formatter, use eslint instead
"prettier.enable": false,
"prettier.enable": true,
"editor.formatOnSave": false,

// Auto fix
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@dcloudio/uni-stacktracey": "3.0.0-3090920231225001",
"@dcloudio/vite-plugin-uni": "3.0.0-3090920231225001",
"@uni-helper/eslint-config": "^0.0.6",
"@uni-helper/unocss-preset-uni": "^0.2.6",
"@uni-helper/unocss-preset-uni": "^0.2.7",
"@uni-helper/vite-plugin-uni-pages": "^0.2.14",
"@unocss/transformer-directives": "0.58.0",
"@viarotel-org/unocss-preset-shades": "^0.7.4",
Expand Down
14 changes: 3 additions & 11 deletions unocss.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
import { defineConfig } from 'unocss'
import transformerDirectives from '@unocss/transformer-directives'
import { presetApplet, presetRemRpx } from 'unocss-applet'
import { presetShades } from '@viarotel-org/unocss-preset-shades'
import presetWind from '@unocss/preset-wind'
import { presetUni } from '@uni-helper/unocss-preset-uni'
import { primaryColor } from './src/configs/index.js'

const isApplet = process.env?.UNI_PLATFORM?.startsWith('mp-') ?? false

const presetMain = isApplet ? presetApplet() : presetWind()
const presetMain = presetUni({ attributify: false })

const presets = [
presetMain,
presetShades(primaryColor),
presetRemRpx(),
]

export default defineConfig({
theme: {
colors: {
gray: presetMain?.theme?.colors?.neutral,
},
},
theme: {},
// @ts-ignore
presets,
transformers: [transformerDirectives()],
Expand Down

0 comments on commit 705c794

Please sign in to comment.