Initial commit v1
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import sharp from 'sharp'
|
||||
import { readFileSync } from 'fs'
|
||||
import { join, dirname } from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const root = join(__dirname, '..')
|
||||
|
||||
const icon = readFileSync(join(root, 'public/icons/icon.svg'))
|
||||
const maskable = readFileSync(join(root, 'public/icons/icon-maskable.svg'))
|
||||
|
||||
await sharp(icon) .resize(192, 192).png().toFile(join(root, 'public/icons/icon-192.png'))
|
||||
await sharp(icon) .resize(512, 512).png().toFile(join(root, 'public/icons/icon-512.png'))
|
||||
await sharp(maskable) .resize(512, 512).png().toFile(join(root, 'public/icons/icon-512-maskable.png'))
|
||||
|
||||
// Apple touch icon (180×180, no transparency — white bg for iOS)
|
||||
await sharp(icon)
|
||||
.resize(180, 180)
|
||||
.flatten({ background: '#ffffff' })
|
||||
.png()
|
||||
.toFile(join(root, 'public/icons/apple-touch-icon.png'))
|
||||
|
||||
// Favicon (32×32)
|
||||
await sharp(icon).resize(32, 32).png().toFile(join(root, 'public/favicon.png'))
|
||||
|
||||
console.log('Icons generated.')
|
||||
Reference in New Issue
Block a user