nobadfonts-cli 1.1.7 → 1.1.9
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/index.js +10 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -214,17 +214,22 @@ async function addFont(fontName) {
|
|
|
214
214
|
existingCss = await fs.readFile(outputCssPath, 'utf8');
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
const newCssBlock = `
|
|
217
|
+
const newCssBlock = `
|
|
218
218
|
/* Font: ${font.name} (Added via NoBadFonts CLI) */
|
|
219
219
|
${cssContent.join('\n')}
|
|
220
|
+
|
|
221
|
+
@theme {
|
|
222
|
+
--font-${font.slug}: "${font.name}", sans-serif;
|
|
223
|
+
}
|
|
220
224
|
`;
|
|
221
225
|
|
|
222
226
|
if (!existingCss.includes(`Font: ${font.name}`)) {
|
|
223
227
|
await fs.outputFile(outputCssPath, existingCss + newCssBlock);
|
|
224
|
-
spinner.succeed(chalk.green(`Updated src/fonts.css with @font-face definitions.`));
|
|
225
|
-
console.log(chalk.blue(`\nSuccess! To use the font
|
|
226
|
-
console.log(chalk.cyan(`font-family:
|
|
227
|
-
console.log(chalk.
|
|
228
|
+
spinner.succeed(chalk.green(`Updated src/fonts.css with @font-face definitions and @theme variable.`));
|
|
229
|
+
console.log(chalk.blue(`\nSuccess! To use the font:`));
|
|
230
|
+
console.log(chalk.cyan(`1. In CSS: font-family: var(--font-${font.slug});`));
|
|
231
|
+
console.log(chalk.cyan(`2. In Tailwind: class="font-${font.slug}"`));
|
|
232
|
+
console.log(chalk.gray(`(Make sure to import './fonts.css' in your src/index.css or main execution file)`));
|
|
228
233
|
} else {
|
|
229
234
|
spinner.info(chalk.yellow(`Font ${font.name} definitions already exist in src/fonts.css`));
|
|
230
235
|
}
|