diff --git a/unocss.config.js b/unocss.config.js index f4fab87..7b6236c 100644 --- a/unocss.config.js +++ b/unocss.config.js @@ -1,23 +1,35 @@ import { defineConfig } from 'unocss' import transformerDirectives from '@unocss/transformer-directives' -import { presetUni } from '@uni-helper/unocss-preset-uni' +import { presetApplet, presetRemRpx } from 'unocss-applet' import { presetShades } from '@viarotel-org/unocss-preset-shades' +import presetWind from '@unocss/preset-wind' import { primaryColor } from './src/configs/index.js' +const isApplet = process.env?.UNI_PLATFORM?.startsWith('mp-') ?? false + +const presetMain = isApplet ? presetApplet() : presetWind() + const presets = [ - presetUni({ attributify: false }), + presetMain, presetShades(primaryColor), + presetRemRpx(), ] export default defineConfig({ + theme: { + colors: { + gray: presetMain?.theme?.colors?.neutral, + }, + }, // @ts-ignore presets, - theme: {}, transformers: [transformerDirectives()], + shortcuts: { 'inset-center': 'absolute top-1/2 left-1/2 transform -translate-y-1/2 -translate-x-1/2', 'inset-x-center': 'absolute left-1/2 transform -translate-x-1/2', 'inset-y-center': 'absolute top-1/2 transform -translate-y-1/2', + 'h-safe-bottom': 'h-[constant(safe-area-inset-bottom)] h-[env(safe-area-inset-bottom)]', }, }) diff --git a/vite.config.js b/vite.config.js index d07328f..41052b4 100644 --- a/vite.config.js +++ b/vite.config.js @@ -18,6 +18,7 @@ import { import { homePage } from './src/configs/index.js' const isDevelopment = process.env.NODE_ENV === 'development' +const isProduction = process.env.NODE_ENV === 'production' // https://vitejs.dev/config/ export default defineConfig({ @@ -27,8 +28,8 @@ export default defineConfig({ mergePages: false, homePage, }), - useRemoveConsole(), useUni(), + ...isProduction ? [useRemoveConsole()] : [], ], server: { cors: true,