|
1 |
| -import * as fs from 'node:fs'; |
2 |
| -import * as path from 'node:path'; |
| 1 | +import * as fs from 'fs'; |
| 2 | +import * as path from 'path'; |
3 | 3 | import { extractClassesFromTemplate, extractClassesFromCss } from './extractors';
|
4 |
| -import { UNCSS_TEMP_DIR } from './constants'; |
5 | 4 |
|
6 | 5 | interface FileInfo {
|
7 | 6 | name: string;
|
@@ -59,18 +58,20 @@ export function processCssFilesToExtractClasses(cssFiles: FileInfo[]): Extracted
|
59 | 58 | * Writes extracted template classes to a file
|
60 | 59 | * @param templateClasses - Array of objects containing extracted classes and file paths
|
61 | 60 | * @param fileName - Name of the output file
|
| 61 | + * @param uncssTempDir - Temporary directory for uncss |
62 | 62 | */
|
63 |
| -export function writeTemplateClassesToFile(templateClasses: ExtractedClasses[], fileName: string): void { |
64 |
| - const outputPath = path.join(UNCSS_TEMP_DIR, fileName); |
| 63 | +export function writeTemplateClassesToFile(templateClasses: ExtractedClasses[], fileName: string, uncssTempDir: string): void { |
| 64 | + const outputPath = path.join(uncssTempDir, fileName); |
65 | 65 | fs.writeFileSync(outputPath, JSON.stringify(templateClasses, null, 2));
|
66 | 66 | }
|
67 | 67 |
|
68 | 68 | /**
|
69 | 69 | * Writes extracted CSS selectors to a file
|
70 | 70 | * @param cssSelectors - Array of objects containing extracted selectors and file paths
|
71 | 71 | * @param fileName - Name of the output file
|
| 72 | + * @param uncssTempDir - Temporary directory for uncss |
72 | 73 | */
|
73 |
| -export function writeCssSelectorsToFile(cssSelectors: ExtractedSelectors[], fileName: string): void { |
74 |
| - const outputPath = path.join(UNCSS_TEMP_DIR, fileName); |
| 74 | +export function writeCssSelectorsToFile(cssSelectors: ExtractedSelectors[], fileName: string, uncssTempDir: string): void { |
| 75 | + const outputPath = path.join(uncssTempDir, fileName); |
75 | 76 | fs.writeFileSync(outputPath, JSON.stringify(cssSelectors, null, 2));
|
76 | 77 | }
|
0 commit comments