mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
import { minify } from "@node-minify/core";
|
|
import { terser } from "@node-minify/terser";
|
|
import { cleanCss } from '@node-minify/clean-css';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const rootPath = path.resolve(__dirname, "../");
|
|
|
|
async function doMinify() {
|
|
await minify({
|
|
compressor: terser,
|
|
input: path.join(rootPath, "data/src/*.js"),
|
|
output: path.join(rootPath, "data/emulator.min.js"),
|
|
})
|
|
.catch(function (err) {
|
|
console.error(err);
|
|
})
|
|
.then(function() {
|
|
console.log("Minified JS");
|
|
});
|
|
await minify({
|
|
compressor: cleanCss,
|
|
input: path.join(rootPath, "data/emulator.css"),
|
|
output: path.join(rootPath, "data/emulator.min.css"),
|
|
})
|
|
.catch(function (err) {
|
|
console.error(err);
|
|
})
|
|
.then(function() {
|
|
console.log("Minified CSS");
|
|
});
|
|
}
|
|
|
|
console.log("Minifying");
|
|
await doMinify();
|
|
console.log("Minifying Done!");
|