MCPcopy Create free account
hub / github.com/TailGrids/tailgrids / createCSSFile

Function createCSSFile

packages/cli/src/actions/init/helpers.ts:33–61  ·  view source on GitHub ↗
(theme: string, spinner: Ora)

Source from the content-addressed store, hash-verified

31}
32
33export async function createCSSFile(theme: string, spinner: Ora) {
34 const fileName = "tailgrids.css";
35
36 try {
37 spinner.text = `Creating ${fileName}...`;
38
39 const templatePath = path.resolve(
40 __dirname,
41 "./templates/themes",
42 `${theme}.css`
43 );
44
45 if (!existsSync(templatePath)) {
46 throw new Error(`Theme template not found for: "${theme}"`);
47 }
48
49 await fs.copyFile(templatePath, fileName);
50
51 spinner.succeed(
52 `Created ${chalk.cyan(fileName)} with ${theme} theme variables`
53 );
54 } catch (error) {
55 spinner.fail(`Failed to create ${fileName}`);
56 if (error instanceof Error) {
57 throw new Error(`Could not create CSS file: ${error.message}`);
58 }
59 throw new Error("Could not create CSS file. Check write permissions.");
60 }
61}
62
63export async function replaceMainCSSFile(
64 theme: string,

Callers 2

handleInitCommandFunction · 0.90
replaceMainCSSFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected