refactor: use _fresh as build cache directory
This commit is contained in:
parent
14bb355c11
commit
d912ea247d
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,5 +9,3 @@
|
|||
_fresh/
|
||||
# npm dependencies
|
||||
node_modules/
|
||||
|
||||
.cache/
|
8
build.ts
8
build.ts
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue