fix(module): transform vue files to detect multi-line components

This commit is contained in:
Benjamin Canac
2023-06-13 15:53:02 +02:00
parent c3f5c44461
commit 88c1930845
2 changed files with 6 additions and 1 deletions

View File

@@ -141,7 +141,7 @@ export const generateSafelist = (colors: string[]) => {
export const customSafelistExtractor = (prefix, content: string, colors: string[]) => {
const classes = []
const regex = /<(\w+)\s+[^>:]*color=["']([^"']+)["'][^>]*>/gs
const matches = [...content.matchAll(regex)]
const matches = content.matchAll(regex)
for (const match of matches) {
const [, component, color] = match

View File

@@ -148,6 +148,11 @@ export default defineNuxtModule<ModuleOptions>({
resolve(runtimeDir, 'components/**/*.{vue,mjs,ts}'),
resolve(runtimeDir, '*.{mjs,js,ts}')
],
transform: {
vue: (content) => {
return content.replaceAll(/(?:\r\n|\r|\n)/g, ' ')
}
},
extract: {
vue: (content) => {
return [