| | |
| | | import { defineConfig, loadEnv } from 'vite' |
| | | import path from 'path' |
| | | import createVitePlugins from './vite/plugins' |
| | | import vue from '@vitejs/plugin-vue'; |
| | | import postcssPxtorem from 'postcss-pxtorem'; // 使用 import 导入 |
| | | |
| | | // https://vitejs.dev/config/ |
| | | export default defineConfig(({ mode, command }) => { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | // postcssPxtorem({ |
| | | // rootValue: 19.2, |
| | | // propList: ['*'], |
| | | // // 只转换带有特定类名的样式 |
| | | // include: (filePath, content) => { |
| | | // return ( |
| | | // filePath.includes('hazardousChemicals/bigScreen/index.vue') && |
| | | // content.includes('data-dashboard') |
| | | // ); |
| | | // } |
| | | // }) |
| | | postcssPxtorem({ |
| | | rootValue: 37.5, |
| | | propList: ['*'], |
| | | selectorBlackList: [/^html$/], |
| | | // 精确匹配大屏组件路径 |
| | | include: (filePath, content = '') => { |
| | | return ( |
| | | content.includes('postcss-pxtorem-enabled') |
| | | ); |
| | | }, |
| | | // 排除其他所有文件 |
| | | exclude: (filePath, content = '') => { |
| | | return !( |
| | | content.includes('postcss-pxtorem-enabled') |
| | | ); |
| | | }, |
| | | mediaQuery: false, |
| | | minPixelValue: 3 |
| | | }) |
| | | ] |
| | | } |
| | | } |