Skip to content

Commit 2c1221c

Browse files
committed
Added sass styles to build.
1 parent 8560159 commit 2c1221c

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

post-build.js

+23-16
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ const outLib = "dist";
1010
* @returns {Promise<void>}
1111
*/
1212
async function postBuild () {
13-
rewrite(outLib);
13+
await rewrite(outLib);
1414
copyFile("./package.json", `./${outLib}/package.json`);
1515
copyFile("./README.md", `./${outLib}/README.md`);
16-
copyFile("./src/lib/style", `./${outLib}/src/lib/style`);
16+
17+
// Copy the SASS files
18+
copyFile("./src/lib/style/base", `./${outLib}/style/base`);
19+
copyFile("./src/lib/style/base.scss", `./${outLib}/style/base.scss`);
1720
}
1821

1922
/**
@@ -48,25 +51,29 @@ function isSCSS (path) {
4851
* @param path
4952
*/
5053
function rewrite (path) {
51-
glob(`${path}/**/*.{ts,scss}`, {}, function (err, files) {
54+
return new Promise(res => {
55+
glob(`${path}/**/*.{ts,scss}`, {}, (err, files) => {
5256

53-
// Check if an error occurred.
54-
if (err) {
55-
throw err;
56-
}
57+
// Check if an error occurred.
58+
if (err) {
59+
throw err;
60+
}
5761

58-
// Rewrite each file
59-
for (const file of files) {
62+
// Rewrite each file
63+
for (const file of files) {
6064

61-
// Don't rewrite declaration files
62-
if (isDeclaration(file)) {
63-
continue;
65+
// Don't rewrite declaration files
66+
if (isDeclaration(file)) {
67+
continue;
68+
}
69+
70+
rewriteFile(file);
71+
replaceExt(file, ".js");
6472
}
6573

66-
rewriteFile(file);
67-
replaceExt(file, ".js");
68-
}
69-
})
74+
res();
75+
});
76+
});
7077
}
7178

7279
/**

0 commit comments

Comments
 (0)