Skip to content

Commit

Permalink
Changed minify
Browse files Browse the repository at this point in the history
  • Loading branch information
DrSnuggles committed Feb 9, 2024
1 parent 5355afa commit 6864e20
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.br
node_modules
2 changes: 1 addition & 1 deletion chiptune3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chiptune3.worklet.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions minify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const fs = require('fs'),
{ minify } = require('terser')
const { mainModule } = require('process')

main()
async function main() {
const config = {
compress: {
dead_code: true,
drop_console: false,
drop_debugger: true,
keep_classnames: false,
keep_fargs: true,
keep_fnames: false,
keep_infinity: false
},
mangle: {
eval: false,
keep_classnames: false,
keep_fnames: false,
toplevel: false,
safari10: false
},
module: false,
sourceMap: false,
output: {
comments: ''
}
}
let code = fs.readFileSync('chiptune3.js', 'utf8')
let minified = await minify(code, config)
fs.writeFileSync('chiptune3.min.js', minified.code)

code = fs.readFileSync('chiptune3.worklet.js', 'utf8')
minified = await minify(code, config)
fs.writeFileSync('chiptune3.worklet.min.js', minified.code)
}
Loading

0 comments on commit 6864e20

Please sign in to comment.