mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-24 08:50:34 +01:00
fix(module): transform vue files to detect multi-line components
This commit is contained in:
@@ -141,7 +141,7 @@ export const generateSafelist = (colors: string[]) => {
|
|||||||
export const customSafelistExtractor = (prefix, content: string, colors: string[]) => {
|
export const customSafelistExtractor = (prefix, content: string, colors: string[]) => {
|
||||||
const classes = []
|
const classes = []
|
||||||
const regex = /<(\w+)\s+[^>:]*color=["']([^"']+)["'][^>]*>/gs
|
const regex = /<(\w+)\s+[^>:]*color=["']([^"']+)["'][^>]*>/gs
|
||||||
const matches = [...content.matchAll(regex)]
|
const matches = content.matchAll(regex)
|
||||||
|
|
||||||
for (const match of matches) {
|
for (const match of matches) {
|
||||||
const [, component, color] = match
|
const [, component, color] = match
|
||||||
|
|||||||
@@ -148,6 +148,11 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
resolve(runtimeDir, 'components/**/*.{vue,mjs,ts}'),
|
resolve(runtimeDir, 'components/**/*.{vue,mjs,ts}'),
|
||||||
resolve(runtimeDir, '*.{mjs,js,ts}')
|
resolve(runtimeDir, '*.{mjs,js,ts}')
|
||||||
],
|
],
|
||||||
|
transform: {
|
||||||
|
vue: (content) => {
|
||||||
|
return content.replaceAll(/(?:\r\n|\r|\n)/g, ' ')
|
||||||
|
}
|
||||||
|
},
|
||||||
extract: {
|
extract: {
|
||||||
vue: (content) => {
|
vue: (content) => {
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user