Skip to content

Commit

Permalink
simplfy css build
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Jan 26, 2025
1 parent 2221e69 commit ab8a024
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
17 changes: 4 additions & 13 deletions packages/glow/css/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,16 @@
import { promises as fs } from 'node:fs'

async function minify(names, toname) {
const raw = []
for (const name of names) {
raw.push(await fs.readFile(`css/${name}.css`, 'utf-8'))
}

const filename = 'tmp.css'
await fs.writeFile(filename, raw.join('\n'))

const min = await (await Bun.build({
entrypoints: [filename],
entrypoints: names.map(name => `css/${name}.css`),
minify: true,
throw: true,
})).outputs[0].text()

await fs.rm(filename)
experimentalCss: true,
})).outputs.map(async file => await file.text())

const to = `minified/${toname}.css`
await fs.writeFile(to, min)
console.log('>', to, min.length)
console.log('>', to, (await fs.stat(to)).size)
}


Expand Down
3 changes: 2 additions & 1 deletion packages/glow/minified/syntax.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ab8a024

Please sign in to comment.