Skip to content

Commit d7353cd

Browse files
committed
change: minify.js — add color to the log
1 parent 711badf commit d7353cd

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

bin/minify.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
import { glob } from "glob";
2+
import chalk from "chalk";
23
import { execSync } from "child_process";
34
import path from "path";
45
import fs from "fs";
56

67
const files = glob.sync("src/assets/js/*.js");
8+
console.log(
9+
`${chalk.gray(`[`)}${chalk.green(`Ew`)}${chalk.gray(`/Terser]`)}`,
10+
chalk.white(`Minifying ${files.length} file(s)`)
11+
);
712
for (const file of files) {
813
const out = path.join("public/js", path.basename(file));
914
fs.mkdirSync(path.dirname(out), { recursive: true });
1015
execSync(`terser "${file}" -o "${out}" -c -m`);
11-
console.log(`Minified: ${file} -> ${out}`);
12-
}
16+
console.log(
17+
`${chalk.gray(`[`)}${chalk.green(`Ew`)}${chalk.gray(`/Terser]`)}`,
18+
chalk.white(`Writing ${out}`),
19+
chalk.gray(`from ${file}`)
20+
);
21+
}
22+
console.log(
23+
`${chalk.gray(`[`)}${chalk.green(`Ew`)}${chalk.gray(`/Terser]`)}`,
24+
chalk.white(`Minification complete ${files.length} file(s)`)
25+
);

0 commit comments

Comments
 (0)