@webmate-studio/builder 0.1.3 → 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
CHANGED
|
@@ -16,8 +16,34 @@ const execAsync = promisify(exec);
|
|
|
16
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
17
|
const __dirname = dirname(__filename);
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
|
|
19
|
+
// Import createRequire for resolving packages
|
|
20
|
+
import { createRequire } from 'module';
|
|
21
|
+
const require = createRequire(import.meta.url);
|
|
22
|
+
|
|
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
|
+
}
|
|
46
|
+
}
|
|
21
47
|
|
|
22
48
|
/**
|
|
23
49
|
* Extract Tailwind classes from HTML content
|
|
@@ -259,8 +285,8 @@ ${themeCSS}
|
|
|
259
285
|
|
|
260
286
|
// Run Tailwind v4 CLI
|
|
261
287
|
// Tailwind v4 auto-detects HTML files in the same directory
|
|
262
|
-
const
|
|
263
|
-
|
|
288
|
+
const tailwindCmd = getTailwindCommand();
|
|
289
|
+
const command = `${tailwindCmd} -i "${inputPath}" ${minify ? '--minify' : ''}`;
|
|
264
290
|
|
|
265
291
|
// Set NODE_PATH so tailwindcss module can be resolved
|
|
266
292
|
const builderNodeModules = join(__dirname, "..", "node_modules");
|
|
@@ -16,8 +16,34 @@ const execAsync = promisify(exec);
|
|
|
16
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
17
|
const __dirname = dirname(__filename);
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
|
|
19
|
+
// Import createRequire for resolving packages
|
|
20
|
+
import { createRequire } from 'module';
|
|
21
|
+
const require = createRequire(import.meta.url);
|
|
22
|
+
|
|
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
|
+
}
|
|
46
|
+
}
|
|
21
47
|
|
|
22
48
|
/**
|
|
23
49
|
* Extract Tailwind classes from HTML content
|
|
@@ -237,8 +263,9 @@ export async function generateTailwindCSS(classes, options = {}) {
|
|
|
237
263
|
const dummyHTML = `<div class="${classArray.join(' ')}"></div>`;
|
|
238
264
|
writeFileSync(htmlPath, dummyHTML);
|
|
239
265
|
|
|
240
|
-
// Run Tailwind CLI
|
|
241
|
-
const
|
|
266
|
+
// Run Tailwind CLI
|
|
267
|
+
const tailwindCmd = getTailwindCommand();
|
|
268
|
+
const command = `${tailwindCmd} -c "${configPath}" -i "${inputPath}" ${minify ? '--minify' : ''}`;
|
|
242
269
|
|
|
243
270
|
const { stdout } = await execAsync(command, {
|
|
244
271
|
maxBuffer: 10 * 1024 * 1024 // 10MB buffer
|