From 09a2c86ad4f6b1b5ff5b84b2d952796b12889121 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Wed, 31 Jul 2024 07:39:39 +0700 Subject: [PATCH] Fix macros/build.renderStylus() not loading CSS each build --- src/macros/build.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/macros/build.ts b/src/macros/build.ts index 750f719..de1cabd 100644 --- a/src/macros/build.ts +++ b/src/macros/build.ts @@ -1,18 +1,19 @@ import stylus from 'stylus'; -import cssStr from "@assets/css/styles.styl" with { type: "text" }; +export const renderStylus = async () => { + const file = Bun.file('./src/assets/css/styles.styl'); + const cssStr = await file.text(); -const generatedCss = await (stylus(cssStr, {}) - .set('filename', 'styles.css') - .set('compress', true) - .include('src/assets/css/')) - .render(); + const generatedCss = await (stylus(cssStr, {}) + .set('filename', 'styles.css') + .set('compress', true) + .include('src/assets/css/')) + .render(); -export const renderStylus = () => { return generatedCss; }; export const compressCss = async (css: string) => { - return await (stylus(css, {}).set('compress', true)).render(); + return await (stylus(css, {}).set('compress', true)).render(); };