@juristr/nx-tailwind-sync 0.0.3 → 0.0.7
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/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Nx [sync generator](https://nx.dev/docs/concepts/sync-generators) that auto-mana
|
|
|
4
4
|
|
|
5
5
|
## Problem
|
|
6
6
|
|
|
7
|
-
Tailwind v4 [requires to define `@source` directives](https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources) for dependencies that might be outside its own project configuration. Something that is common in monorepos. Manually maintaining these in a monorepo is error-prone.
|
|
7
|
+
Tailwind v4 [requires to define `@source` directives](https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources) for dependencies that might be outside its own project configuration. Something that is common in monorepos. Manually maintaining these in a monorepo is error-prone. See [this blog post](https://nx.dev/blog/setup-tailwind-4-npm-workspace) for more background.
|
|
8
8
|
|
|
9
9
|
## Solution
|
|
10
10
|
|
|
@@ -23,7 +23,7 @@ function findTailwindCssFile(tree, projectRoot, additionalPaths = []) {
|
|
|
23
23
|
for (const relPath of searchPaths) {
|
|
24
24
|
const fullPath = (0, path_1.join)(projectRoot, relPath);
|
|
25
25
|
const content = tree.read(fullPath)?.toString();
|
|
26
|
-
if (content?.match(/@import\s+['"]tailwindcss[^'"]*['"]
|
|
26
|
+
if (content?.match(/@import\s+['"]tailwindcss[^'"]*['"](\s+source\([^)]*\))?/)) {
|
|
27
27
|
return fullPath;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -143,7 +143,7 @@ function updateSourceDirectives(tree, projectName, cssFilePath, projectGraph) {
|
|
|
143
143
|
// Remove any existing bare @source directives (migration from old format)
|
|
144
144
|
const cleanedContent = currentContent.replace(/\n@source\s+["'][^"']*packages\/[^"']+["'];/g, '');
|
|
145
145
|
// Try to find @import 'tailwindcss' first
|
|
146
|
-
const tailwindImportRegex = /@import\s+['"]tailwindcss[^'"]*['"]
|
|
146
|
+
const tailwindImportRegex = /@import\s+['"]tailwindcss[^'"]*['"](\s+source\([^)]*\))?;/;
|
|
147
147
|
const tailwindImportMatch = cleanedContent.match(tailwindImportRegex);
|
|
148
148
|
// If not found, look for any @import statement
|
|
149
149
|
const anyImportRegex = /@import\s+['"][^'"]+['"];/;
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juristr/nx-tailwind-sync",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"author": "Juri Strumpflohner",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/juristr/nx-tailwind-sync.git"
|
|
9
|
+
},
|
|
7
10
|
"main": "./dist/index.js",
|
|
8
11
|
"module": "./dist/index.js",
|
|
9
12
|
"types": "./dist/index.d.ts",
|