Skip to content

Commit 0353dab

Browse files
committed
cleanup: updated sass compiling
Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de>
1 parent b3efacf commit 0353dab

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

build.ts

+5-15
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { exec as execCommand } from "child_process";
55
import { ncp } from "ncp";
66
import terser from "terser";
77
import chokidar from "chokidar";
8-
import sass, { Result } from "sass";
8+
import sass from "sass";
99
import autoprefixer from "autoprefixer";
1010
import postcss from "postcss";
1111

@@ -46,10 +46,7 @@ async function uglify(src: string) {
4646
},
4747
});
4848

49-
if (minified.error) {
50-
logErr(minified.error);
51-
}
52-
return minified.code;
49+
return minified.code as string;
5350
}
5451

5552
async function buildBundleJs() {
@@ -69,16 +66,9 @@ async function buildScripts() {
6966
}
7067

7168
async function transpileStyle(src: string, compress = false) {
72-
return new Promise<string>((resolve, reject) => {
73-
sass.render(
74-
{
75-
file: src,
76-
outputStyle: compress ? "compressed" : "expanded",
77-
},
78-
async (err: Error | undefined, result: Result) =>
79-
!err ? resolve((await postcss([autoprefixer]).process(result.css.toString())).css) : reject(err)
80-
);
81-
});
69+
const sassResult = await sass.compileAsync(src, { style: compress ? "compressed" : "expanded" });
70+
const postCssResult = await postcss([autoprefixer]).process(sassResult.css);
71+
return postCssResult.css;
8272
}
8373

8474
async function buildStyle() {

0 commit comments

Comments
 (0)