Merge pull request #75 from spriteApe/base
fix: 解决uno.css写hex颜色等功能不高亮问题
This commit is contained in:
commit
c870156c04
@ -1,7 +1,8 @@
|
|||||||
// uno.config.ts
|
// uno.config.ts
|
||||||
import {
|
import {
|
||||||
Preset,
|
type Preset,
|
||||||
defineConfig,
|
defineConfig,
|
||||||
|
presetUno,
|
||||||
presetAttributify,
|
presetAttributify,
|
||||||
presetIcons,
|
presetIcons,
|
||||||
transformerDirectives,
|
transformerDirectives,
|
||||||
@ -13,26 +14,23 @@ import { presetApplet, presetRemRpx, transformerAttributify } from 'unocss-apple
|
|||||||
// @see https://unocss.dev/presets/legacy-compat
|
// @see https://unocss.dev/presets/legacy-compat
|
||||||
import { presetLegacyCompat } from '@unocss/preset-legacy-compat'
|
import { presetLegacyCompat } from '@unocss/preset-legacy-compat'
|
||||||
|
|
||||||
const isH5 = process.env?.UNI_PLATFORM === 'h5'
|
|
||||||
const isMp = process.env?.UNI_PLATFORM?.startsWith('mp') ?? false
|
const isMp = process.env?.UNI_PLATFORM?.startsWith('mp') ?? false
|
||||||
|
|
||||||
const presets: Preset[] = []
|
const presets: Preset[] = []
|
||||||
if (!isMp) {
|
if (isMp) {
|
||||||
/**
|
// 使用小程序预设
|
||||||
* you can add `presetAttributify()` here to enable unocss attributify mode prompt
|
presets.push(presetApplet(), presetRemRpx())
|
||||||
* although preset is not working for applet, but will generate useless css
|
} else {
|
||||||
* 为了不生产无用的css,要过滤掉 applet
|
presets.push(
|
||||||
*/
|
// 非小程序用官方预设
|
||||||
// 支持css class属性化,eg: `<button bg="blue-400 hover:blue-500 dark:blue-500 dark:hover:blue-600" text="sm white">attributify Button</button>`
|
presetUno(),
|
||||||
presets.push(presetAttributify())
|
// 支持css class属性化
|
||||||
}
|
presetAttributify(),
|
||||||
if (!isH5) {
|
)
|
||||||
presets.push(presetRemRpx())
|
|
||||||
}
|
}
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
presets: [
|
presets: [
|
||||||
...presets,
|
...presets,
|
||||||
presetApplet(),
|
|
||||||
// 支持图标,需要搭配图标库,eg: @iconify-json/carbon, 使用 `<button class="i-carbon-sun dark:i-carbon-moon" />`
|
// 支持图标,需要搭配图标库,eg: @iconify-json/carbon, 使用 `<button class="i-carbon-sun dark:i-carbon-moon" />`
|
||||||
presetIcons({
|
presetIcons({
|
||||||
scale: 1.2,
|
scale: 1.2,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user