Skip to content

Commit ce97b60

Browse files
committed
feat: add .cache file for log and debug
1 parent d50c9f5 commit ce97b60

File tree

16 files changed

+155
-65
lines changed

16 files changed

+155
-65
lines changed

apps/next-app/next.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ const { webpackPlugin: utwm } = require('unplugin-tailwindcss-mangle')
55
const nextConfig = {
66
reactStrictMode: true,
77
webpack: (config) => {
8-
config.plugins.push(utwm())
8+
config.plugins.push(utwm({
9+
classSetOutput: true,
10+
classMapOutput: true
11+
}))
912
return config
1013
}
1114
}

apps/nuxt-app/nuxt.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ export default defineNuxtConfig({
1212
[
1313
nuxtPlugin,
1414
{
15-
classSetOutput: {
16-
type: 'all'
17-
}
15+
classSetOutput: true,
16+
classMapOutput: true
1817
}
1918
]
2019
]

apps/solid-app/vite.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import { defineConfig } from 'vite'
22
import solidPlugin from 'vite-plugin-solid'
33
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
44
export default defineConfig({
5-
plugins: [solidPlugin(), utwm()],
5+
plugins: [
6+
solidPlugin(),
7+
utwm({
8+
classSetOutput: true,
9+
classMapOutput: true
10+
})
11+
],
612
server: {
713
port: 3000
814
},

apps/vite-lit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
],
1515
"scripts": {
1616
"dev": "vite",
17-
"build": "tsc && vite build",
17+
"_build": "tsc && vite build",
1818
"prepare": "tw-patch"
1919
},
2020
"dependencies": {

apps/vite-react/vite.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ import react from '@vitejs/plugin-react'
33
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
44
// https://vitejs.dev/config/
55
export default defineConfig({
6-
plugins: [react(), utwm()]
6+
plugins: [
7+
react(),
8+
utwm({
9+
classSetOutput: true,
10+
classMapOutput: true
11+
})
12+
]
713
})

apps/vite-svelte/vite.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ import { svelte } from '@sveltejs/vite-plugin-svelte'
33
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
44
// https://vitejs.dev/config/
55
export default defineConfig({
6-
plugins: [svelte(), utwm()]
6+
plugins: [
7+
svelte(),
8+
utwm({
9+
classSetOutput: true,
10+
classMapOutput: true
11+
})
12+
]
713
})

apps/vite-vanilla/vite.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@ import { defineConfig } from 'vite'
22
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
33
// https://vitejs.dev/config/
44
export default defineConfig({
5-
plugins: [utwm()]
5+
plugins: [
6+
utwm({
7+
classSetOutput: true,
8+
classMapOutput: true
9+
})
10+
]
611
})

apps/vite-vue/vite.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ import vue from '@vitejs/plugin-vue'
33
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
44
// https://vitejs.dev/config/
55
export default defineConfig({
6-
plugins: [vue(), utwm()]
6+
plugins: [
7+
vue(),
8+
utwm({
9+
classSetOutput: true,
10+
classMapOutput: true
11+
})
12+
]
713
})

apps/webpack5-vue3/vue.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ module.exports = defineConfig({
44
transpileDependencies: true,
55
configureWebpack: (config) => {
66
config.plugins.push(utwm({
7-
classSetOutput: true
7+
classSetOutput: true,
8+
classMapOutput: true
89
}))
910
}
1011
})

packages/unplugin-tailwindcss-mangle/src/css/plugins.ts

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,18 @@ const postcssMangleTailwindcssPlugin: PostcssMangleTailwindcssPlugin = (options)
2424
if (s.value) {
2525
const hit = newClassMap[s.value]
2626
if (hit) {
27-
// console.log(s.value, hit.name)
27+
// vue scoped
28+
if (s.parent) {
29+
const idx = s.parent.nodes.indexOf(s)
30+
if (idx > -1) {
31+
const nextNode = s.parent.nodes[idx + 1]
32+
if (nextNode && nextNode.type === 'attribute' && nextNode.attribute.indexOf('data-v-') > -1) {
33+
return
34+
}
35+
}
36+
}
2837
s.value = hit.name
2938
}
30-
// for vue scoped gap-y-4[data-v-0f84999b]
31-
// const idx = s.value.indexOf('[data-v-')
32-
// const isVueScoped = idx > -1
33-
// if (isVueScoped) {
34-
// const prefixCls = s.value.substring(0, idx)
35-
// const hit = newClassMap[prefixCls]
36-
// if (hit) {
37-
// s.value = hit.name + s.value.substring(idx)
38-
// }
39-
// } else {
40-
// const hit = newClassMap[s.value]
41-
// if (hit) {
42-
// // console.log(s.value, hit.name)
43-
// s.value = hit.name
44-
// }
45-
// }
4639
}
4740
})
4841
}).processSync(rule.selector)

0 commit comments

Comments
 (0)