@juristr/nx-tailwind-sync 0.0.7 → 0.0.8-beta.2
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 +1 -1
- package/dist/generators/{update-tailwind-globs.d.ts → tailwind-source-directives.d.ts} +1 -1
- package/dist/generators/tailwind-source-directives.d.ts.map +1 -0
- package/dist/generators/{update-tailwind-globs.js → tailwind-source-directives.js} +10 -2
- package/generators.json +2 -2
- package/package.json +1 -1
- package/dist/generators/update-tailwind-globs.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ Register the sync generator on tasks that need it (e.g., `build`, `dev`):
|
|
|
48
48
|
"nx": {
|
|
49
49
|
"targets": {
|
|
50
50
|
"build": {
|
|
51
|
-
"syncGenerators": ["@juristr/nx-tailwind-sync:
|
|
51
|
+
"syncGenerators": ["@juristr/nx-tailwind-sync:tailwind-source-directives"]
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -3,4 +3,4 @@ import { SyncGeneratorResult } from 'nx/src/utils/sync-generators';
|
|
|
3
3
|
import { UpdateTailwindGlobsGeneratorSchema } from './schema';
|
|
4
4
|
export declare function updateTailwindGlobsGenerator(tree: Tree, options?: UpdateTailwindGlobsGeneratorSchema): Promise<SyncGeneratorResult>;
|
|
5
5
|
export default updateTailwindGlobsGenerator;
|
|
6
|
-
//# sourceMappingURL=
|
|
6
|
+
//# sourceMappingURL=tailwind-source-directives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-source-directives.d.ts","sourceRoot":"","sources":["../../src/generators/tailwind-source-directives.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAIL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAwP9D,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,kCAAuC,GAC/C,OAAO,CAAC,mBAAmB,CAAC,CAmC9B;AAED,eAAe,4BAA4B,CAAC"}
|
|
@@ -152,10 +152,18 @@ function updateSourceDirectives(tree, projectName, cssFilePath, projectGraph) {
|
|
|
152
152
|
let newContent;
|
|
153
153
|
if (importMatch && importMatch.index !== undefined) {
|
|
154
154
|
// Insert after the import line
|
|
155
|
-
const
|
|
155
|
+
const newlineIndex = cleanedContent.indexOf('\n', importMatch.index);
|
|
156
|
+
// Handle case where import is last line with no trailing newline
|
|
157
|
+
const importEndIndex = newlineIndex === -1 ? cleanedContent.length : newlineIndex + 1;
|
|
156
158
|
const beforeImport = cleanedContent.substring(0, importEndIndex);
|
|
157
159
|
const afterImport = cleanedContent.substring(importEndIndex);
|
|
158
|
-
newContent =
|
|
160
|
+
newContent =
|
|
161
|
+
beforeImport +
|
|
162
|
+
(newlineIndex === -1 ? '\n' : '') +
|
|
163
|
+
'\n' +
|
|
164
|
+
managedBlock +
|
|
165
|
+
'\n' +
|
|
166
|
+
afterImport;
|
|
159
167
|
}
|
|
160
168
|
else {
|
|
161
169
|
// No imports found, prepend to file
|
package/generators.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {
|
|
3
|
-
"
|
|
4
|
-
"factory": "./dist/generators/
|
|
3
|
+
"tailwind-source-directives": {
|
|
4
|
+
"factory": "./dist/generators/tailwind-source-directives",
|
|
5
5
|
"schema": "./dist/generators/schema.json",
|
|
6
6
|
"description": "Nx Sync generator to update @source directives in CSS files for Tailwind v4 monorepos"
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-tailwind-globs.d.ts","sourceRoot":"","sources":["../../src/generators/update-tailwind-globs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAIL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AA+O9D,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,kCAAuC,GAC/C,OAAO,CAAC,mBAAmB,CAAC,CAmC9B;AAED,eAAe,4BAA4B,CAAC"}
|