refactor: use _fresh as build cache directory

This commit is contained in:
Julien Oculi 2024-01-14 20:54:49 +01:00
parent 14bb355c11
commit d912ea247d
2 changed files with 4 additions and 6 deletions

2
.gitignore vendored
View file

@ -9,5 +9,3 @@
_fresh/
# npm dependencies
node_modules/
.cache/

View file

@ -3,6 +3,7 @@ import { ensureDir } from '$std/fs/mod.ts'
import { parse, resolve } from '$std/path/mod.ts'
console.log('building styles starts')
await ensureDir('_fresh')
try {
//prevent Deno from exiting before bundle
@ -30,8 +31,7 @@ try {
const response = await fetch(specifier)
const file = await response.text()
await ensureDir('.cache')
const filename = `.cache/${crypto.randomUUID()}.css`
const filename = `_fresh/${crypto.randomUUID()}`
await Deno.writeTextFile(filename, file)
cssImports.set(specifier, filename)
return filename
@ -40,11 +40,11 @@ try {
})
await Deno.writeTextFile(
'./static/styles.css',
'./_fresh/styles.css',
new TextDecoder().decode(code),
)
await Deno.writeTextFile(
'./static/styles.map.css',
'./_fresh/styles.map.css',
new TextDecoder().decode(map!),
)
} catch (error) {