Skip to content

Commit b7d3517

Browse files
author
Rishi Raj Jain
committed
feat: introduce per config verbose to create less noise in terminals
1 parent 0f96169 commit b7d3517

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

packages/astro-font/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"license": "MIT",
33
"type": "module",
44
"private": false,
5-
"version": "0.0.75",
5+
"version": "0.0.76",
66
"name": "astro-font",
77
"types": "index.d.ts",
88
"exports": {

packages/astro-font/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface Config {
2222
src: Source[]
2323
fetch?: boolean
2424
display: string
25+
verbose?: boolean
2526
selector?: string
2627
preload?: boolean
2728
cacheDir?: string
@@ -269,13 +270,17 @@ async function getFallbackFont(fontCollection: Config): Promise<Record> {
269270
if (cacheDir) {
270271
if (!fs.existsSync(cacheDir)) {
271272
fs.mkdirSync(cacheDir)
272-
console.log(`[astro-font] ▶ Created ${cacheDir}`)
273+
if (fontCollection.verbose) {
274+
console.log(`[astro-font] ▶ Created ${cacheDir}`)
275+
}
273276
}
274277
}
275278
if (cachedFilePath) {
276279
if (!fs.existsSync(cachedFilePath)) {
277280
fs.writeFileSync(cachedFilePath, JSON.stringify(fallbackMetrics), 'utf8')
278-
console.log(`[astro-font] ▶ Created ${cachedFilePath}`)
281+
if (fontCollection.verbose) {
282+
console.log(`[astro-font] ▶ Created ${cachedFilePath}`)
283+
}
279284
}
280285
}
281286
}

src/pages/third.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { AstroFont } from 'astro-font'
1919
path: join(process.cwd(), 'public', 'assets', 'fonts', 'Deacon-Black.woff2'),
2020
},
2121
],
22+
verbose: true,
2223
preload: true,
2324
display: 'swap',
2425
fallback: 'sans-serif',

0 commit comments

Comments
 (0)