mirror of
https://github.com/zen-browser/surfer.git
synced 2025-07-08 09:20:01 +02:00
⚡️ Copy images instead of regenerating them
This commit is contained in:
parent
d26f961d0a
commit
0b0cdd1487
1 changed files with 7 additions and 3 deletions
|
@ -7,6 +7,7 @@ import {
|
|||
writeFileSync,
|
||||
copyFileSync,
|
||||
} from 'fs'
|
||||
import { copyFile } from 'fs/promises'
|
||||
import { dirname, extname, join } from 'path'
|
||||
import sharp from 'sharp'
|
||||
|
||||
|
@ -67,13 +68,16 @@ function constructConfig(name: string) {
|
|||
}
|
||||
|
||||
async function setupImages(configPath: string, outputPath: string) {
|
||||
// TODO: This can be made parallel to avoid problems with cpu vs disk access
|
||||
for (const size of [16, 22, 24, 32, 48, 64, 128, 256]) {
|
||||
await sharp(join(configPath, 'logo.png'))
|
||||
.resize(size, size)
|
||||
.toFile(join(outputPath, `default${size}.png`))
|
||||
await sharp(join(configPath, 'logo.png'))
|
||||
.resize(size, size)
|
||||
.toFile(join(configPath, `logo${size}.png`))
|
||||
|
||||
await copyFile(
|
||||
join(outputPath, `default${size}.png`),
|
||||
join(configPath, `logo${size}.png`)
|
||||
)
|
||||
}
|
||||
|
||||
await sharp(join(configPath, 'logo.png'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue