@webmate-studio/builder 0.1.4 → 0.1.5
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/package.json +1 -1
- package/src/tailwind-generator-v4.js +26 -18
- package/src/tailwind-generator.js +27 -18
package/package.json
CHANGED
|
@@ -16,25 +16,33 @@ const execAsync = promisify(exec);
|
|
|
16
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
17
|
const __dirname = dirname(__filename);
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// Import createRequire for resolving packages
|
|
20
20
|
import { createRequire } from 'module';
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Get tailwindcss command for execution
|
|
25
|
+
* @returns {string} Command to run tailwindcss
|
|
26
|
+
*/
|
|
27
|
+
function getTailwindCommand() {
|
|
28
|
+
try {
|
|
29
|
+
// Try to resolve tailwindcss package
|
|
30
|
+
const tailwindPackagePath = require.resolve('tailwindcss/package.json');
|
|
31
|
+
const tailwindDir = dirname(tailwindPackagePath);
|
|
32
|
+
|
|
33
|
+
// Check if we're on Windows
|
|
34
|
+
const isWindows = process.platform === 'win32';
|
|
35
|
+
const binName = isWindows ? 'tailwindcss.cmd' : 'tailwindcss';
|
|
36
|
+
|
|
37
|
+
// Build path to bin
|
|
38
|
+
const binPath = join(tailwindDir, '..', '.bin', binName);
|
|
39
|
+
|
|
40
|
+
// Return just npx command - will be resolved at runtime
|
|
41
|
+
return 'npx tailwindcss';
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// Fallback to npx
|
|
44
|
+
return 'npx tailwindcss';
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
/**
|
|
@@ -277,8 +285,8 @@ ${themeCSS}
|
|
|
277
285
|
|
|
278
286
|
// Run Tailwind v4 CLI
|
|
279
287
|
// Tailwind v4 auto-detects HTML files in the same directory
|
|
280
|
-
const
|
|
281
|
-
|
|
288
|
+
const tailwindCmd = getTailwindCommand();
|
|
289
|
+
const command = `${tailwindCmd} -i "${inputPath}" ${minify ? '--minify' : ''}`;
|
|
282
290
|
|
|
283
291
|
// Set NODE_PATH so tailwindcss module can be resolved
|
|
284
292
|
const builderNodeModules = join(__dirname, "..", "node_modules");
|
|
@@ -16,25 +16,33 @@ const execAsync = promisify(exec);
|
|
|
16
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
17
|
const __dirname = dirname(__filename);
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// Import createRequire for resolving packages
|
|
20
20
|
import { createRequire } from 'module';
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Get tailwindcss command for execution
|
|
25
|
+
* @returns {string} Command to run tailwindcss
|
|
26
|
+
*/
|
|
27
|
+
function getTailwindCommand() {
|
|
28
|
+
try {
|
|
29
|
+
// Try to resolve tailwindcss package
|
|
30
|
+
const tailwindPackagePath = require.resolve('tailwindcss/package.json');
|
|
31
|
+
const tailwindDir = dirname(tailwindPackagePath);
|
|
32
|
+
|
|
33
|
+
// Check if we're on Windows
|
|
34
|
+
const isWindows = process.platform === 'win32';
|
|
35
|
+
const binName = isWindows ? 'tailwindcss.cmd' : 'tailwindcss';
|
|
36
|
+
|
|
37
|
+
// Build path to bin
|
|
38
|
+
const binPath = join(tailwindDir, '..', '.bin', binName);
|
|
39
|
+
|
|
40
|
+
// Return just npx command - will be resolved at runtime
|
|
41
|
+
return 'npx tailwindcss';
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// Fallback to npx
|
|
44
|
+
return 'npx tailwindcss';
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
/**
|
|
@@ -255,8 +263,9 @@ export async function generateTailwindCSS(classes, options = {}) {
|
|
|
255
263
|
const dummyHTML = `<div class="${classArray.join(' ')}"></div>`;
|
|
256
264
|
writeFileSync(htmlPath, dummyHTML);
|
|
257
265
|
|
|
258
|
-
// Run Tailwind CLI
|
|
259
|
-
const
|
|
266
|
+
// Run Tailwind CLI
|
|
267
|
+
const tailwindCmd = getTailwindCommand();
|
|
268
|
+
const command = `${tailwindCmd} -c "${configPath}" -i "${inputPath}" ${minify ? '--minify' : ''}`;
|
|
260
269
|
|
|
261
270
|
const { stdout } = await execAsync(command, {
|
|
262
271
|
maxBuffer: 10 * 1024 * 1024 // 10MB buffer
|