|
|
@@ -2,7 +2,7 @@
|
|
|
* @Author: wjc
|
|
|
* @Date: 2023-05-07 20:59:28
|
|
|
* @LastEditors: LiZhiWei
|
|
|
- * @LastEditTime: 2026-01-19 15:56:48
|
|
|
+ * @LastEditTime: 2026-01-20 16:03:07
|
|
|
* @Description:
|
|
|
*/
|
|
|
import {
|
|
|
@@ -26,19 +26,28 @@ export default defineConfig({
|
|
|
// cdn: 'https://esm.sh/'
|
|
|
collections: {
|
|
|
custom: FileSystemIconLoader('./app/assets/icons'),
|
|
|
- ep: () => import('@iconify-json/ep/icons.json').then((i) => i.default),
|
|
|
+ // ep: () => import('@iconify-json/ep/icons.json').then((i) => i.default),
|
|
|
},
|
|
|
}),
|
|
|
],
|
|
|
transformers: [transformerDirectives(), transformerVariantGroup()],
|
|
|
+ content: {
|
|
|
+ pipeline: {
|
|
|
+ include: [/\.(vue|tsx?|jsx?|mdx?|html)($|\?)/],
|
|
|
+ },
|
|
|
+ filesystem: ['app/**/*.{vue,ts,tsx,js,jsx}'],
|
|
|
+ },
|
|
|
postprocess: (util) => {
|
|
|
const pxRE = /(-?[\d.]+px)/g
|
|
|
- // 检查是否属于移动端变体(通过选择器或媒体查询父级判断)
|
|
|
+ // 增强安全性判断,确保在构建扫描阶段不会因 selector 或 parent 为空而报错
|
|
|
+ const selector = util.selector || ''
|
|
|
+ const parent = typeof util.parent === 'string' ? util.parent : ''
|
|
|
+
|
|
|
const isMobile =
|
|
|
- util.selector.includes('lt-sm') ||
|
|
|
- util.selector.includes('lt-xs') ||
|
|
|
- (util.parent?.includes('max-width: 767') ?? false) ||
|
|
|
- (util.parent?.includes('max-width: 479') ?? false)
|
|
|
+ selector.includes('lt-sm') ||
|
|
|
+ selector.includes('lt-xs') ||
|
|
|
+ parent.includes('max-width: 767.9px') ||
|
|
|
+ parent.includes('max-width: 479.9px')
|
|
|
|
|
|
if (isMobile) {
|
|
|
util.entries.forEach((i) => {
|
|
|
@@ -59,10 +68,10 @@ export default defineConfig({
|
|
|
[/^m-v-(.+)$/, ([, d]) => ({ 'margin-top': `${d}`, 'margin-bottom': `${d}` })],
|
|
|
[/^p-h-(.+)$/, ([, d]) => ({ 'padding-left': `${d}`, 'padding-right': `${d}` })],
|
|
|
[/^p-v-(.+)$/, ([, d]) => ({ 'padding-top': `${d}`, 'padding-bottom': `${d}` })],
|
|
|
- [/^max-w-(\s+)$/, ([, d]) => ({ 'max-width': `${d}` })],
|
|
|
- [/^min-w-(\s+)$/, ([, d]) => ({ 'min-width': `${d}` })],
|
|
|
- [/^max-h-[(\s+)]$/, ([, d]) => ({ 'max-height': `${d}` })],
|
|
|
- [/^min-h-[(\s+)]$/, ([, d]) => ({ 'min-height': `${d}` })],
|
|
|
+ [/^max-w-(.+)$/, ([, d]) => ({ 'max-width': `${d}` })],
|
|
|
+ [/^min-w-(.+)$/, ([, d]) => ({ 'min-width': `${d}` })],
|
|
|
+ [/^max-h-(.+)$/, ([, d]) => ({ 'max-height': `${d}` })],
|
|
|
+ [/^min-h-(.+)$/, ([, d]) => ({ 'min-height': `${d}` })],
|
|
|
[/^font-s-(\d+(\.\d+)?\w+)$/, ([, d]) => ({ 'font-size': `${d}` })],
|
|
|
[/^wh-(.+)$/, ([, d]) => ({ width: `${d}`, height: `${d}` })],
|
|
|
[/^bg-color-(\d+)$/, ([, d]) => ({ 'background-color': `${d}` })],
|