veslx 0.1.39 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/package.json.js +1 -1
- package/package.json +1 -1
- package/plugin/src/plugin.ts +28 -18
package/package.json
CHANGED
package/plugin/src/plugin.ts
CHANGED
|
@@ -344,26 +344,36 @@ export default function contentPlugin(contentDir: string, config?: VeslxConfig,
|
|
|
344
344
|
}
|
|
345
345
|
},
|
|
346
346
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
if (id.endsWith('/src/index.css')
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
347
|
+
load(id) {
|
|
348
|
+
// Inject @source directive into index.css for Tailwind v4 content scanning
|
|
349
|
+
// This must happen in load() before Tailwind processes the CSS
|
|
350
|
+
if (id.endsWith('/src/index.css')) {
|
|
351
|
+
const veslxRoot = path.dirname(path.dirname(__dirname))
|
|
352
|
+
const cssPath = path.join(veslxRoot, 'src/index.css')
|
|
353
|
+
|
|
354
|
+
try {
|
|
355
|
+
const code = fs.readFileSync(cssPath, 'utf-8')
|
|
356
|
+
|
|
357
|
+
// Check if this CSS file has the tailwindcss import
|
|
358
|
+
if (/\@import\s+["']tailwindcss["']/.test(code)) {
|
|
359
|
+
// Use absolute path with glob pattern for @source directive
|
|
360
|
+
// Must include all file types that may contain Tailwind classes
|
|
361
|
+
const absoluteContentDir = dir.replace(/\\/g, '/')
|
|
362
|
+
const sourceDirective = `@source "${absoluteContentDir}/**/*.{html,js,jsx,ts,tsx,mdx,md,vue,svelte}";`
|
|
363
|
+
|
|
364
|
+
// Inject @source directive after the tailwindcss import
|
|
365
|
+
const modified = code.replace(
|
|
366
|
+
/(@import\s+["']tailwindcss["'];?)/,
|
|
367
|
+
`$1\n${sourceDirective}`
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
return modified
|
|
371
|
+
}
|
|
372
|
+
} catch {
|
|
373
|
+
// Fall through to default loading
|
|
374
|
+
}
|
|
363
375
|
}
|
|
364
|
-
},
|
|
365
376
|
|
|
366
|
-
load(id) {
|
|
367
377
|
// Virtual module for content
|
|
368
378
|
if (id === RESOLVED_VIRTUAL_MODULE_ID) {
|
|
369
379
|
// Extract frontmatter from MDX files at build time (avoids MDX hook issues)
|