ci: fix source map missing pragma

This commit is contained in:
Julien Oculi 2024-02-05 13:05:19 +01:00
parent abc3a66a33
commit c1c1b287da

View file

@ -17,12 +17,22 @@ export async function bundleCss(
try {
const { code, map } = await builder({ filename, dev, assetDir })
await Deno.writeFile(join(assetDir, pathname), code)
if (map) {
//# sourceMappingURL=fresh_dev_client.js.map
const sourceMappingURL = new TextEncoder().encode(
`\n/*# sourceMappingURL=${pathname.replace('.css', '.map.css')} */`,
)
await Deno.writeFile(
join(assetDir, pathname),
Uint8Array.of(...code, ...sourceMappingURL),
)
await Deno.writeFile(
join(assetDir, pathname.replace('.css', '.map.css')),
map,
)
} else {
await Deno.writeFile(join(assetDir, pathname), code)
}
} catch (error) {
Logger.error('error during bundle, cleaning cache', error)