Skip to content

Commit c1c7c97

Browse files
committed
feat: support vite transformIndexHtml
1 parent cf46c50 commit c1c7c97

File tree

11 files changed

+31
-34
lines changed

11 files changed

+31
-34
lines changed

apps/vite-vue/tailwind.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
export default {
33
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx,vue}'],
44
theme: {
5-
extend: {}
5+
extend: {},
66
},
77
plugins: [],
88
corePlugins: {
9-
preflight: false
10-
}
9+
preflight: false,
10+
},
1111
}

apps/webpack5-vue3/.eslintrc.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

apps/webpack5-vue3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
"tailwindcss": "^3.4.4",
3838
"typescript": "~5.5.2"
3939
}
40-
}
40+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import { defineConfig } from 'tailwindcss-patch'
22

3-
export default defineConfig({})
3+
export default defineConfig({})

apps/webpack5-vue3/vue.config.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ const utwm = require('unplugin-tailwindcss-mangle/webpack')
33

44
module.exports = defineConfig({
55
transpileDependencies: true,
6-
configureWebpack: (config) => {
7-
config.plugins.push(utwm({
8-
classMapOutput: true,
9-
}))
10-
},
6+
// configureWebpack: (config) => {
7+
// config.plugins.push(utwm({
8+
// classMapOutput: true,
9+
// }))
10+
// },
11+
1112
})

packages/config/tsup.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ export default defineConfig({
88
format: ['cjs', 'esm'],
99
clean: true,
1010
dts: true,
11+
// cjsInterop: true,
12+
// splitting: true,
1113
})

packages/core/tsup.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ export default defineConfig({
88
format: ['cjs', 'esm'],
99
clean: true,
1010
dts: true,
11+
// cjsInterop: true,
12+
// splitting: true,
1113
})

packages/shared/tsup.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ export default defineConfig({
88
format: ['cjs', 'esm'],
99
clean: true,
1010
dts: true,
11+
// cjsInterop: true,
12+
// splitting: true,
1113
})

packages/tailwindcss-patch/tsup.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ export default defineConfig({
77
clean: true,
88
format: ['cjs', 'esm'], // , 'esm'
99
dts: true,
10+
// cjsInterop: true,
11+
// splitting: true,
1012
})

packages/unplugin-tailwindcss-mangle/src/core/factory.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { UnpluginFactory } from 'unplugin'
2-
import { Context, cssHandler, preProcessJs, vueHandler } from '@tailwindcss-mangle/core'
2+
import { Context, cssHandler, htmlHandler, preProcessJs, vueHandler } from '@tailwindcss-mangle/core'
33
import type { MangleUserConfig } from '@tailwindcss-mangle/config'
44
import MagicString from 'magic-string'
5-
// import { createFilter } from '@rollup/pluginutils'
65
import { isCSSRequest } from 'is-css-request'
76
import { pluginName } from '@/constants'
87

@@ -55,9 +54,15 @@ const factory: UnpluginFactory<MangleUserConfig | undefined> = (options) => {
5554
return css
5655
},
5756
},
58-
// {
59-
// name: `${pluginName}:post`,
60-
// },
57+
{
58+
name: `${pluginName}:post`,
59+
enforce: 'post',
60+
vite: {
61+
transformIndexHtml(code) {
62+
return htmlHandler(code, { ctx })
63+
},
64+
},
65+
},
6166
]
6267
}
6368

0 commit comments

Comments
 (0)