Skip to content

Instantly share code, notes, and snippets.

@tyler6699
Created August 17, 2019 22:21
Show Gist options
  • Save tyler6699/c2e827a19696d97be11ea0d4fb701668 to your computer and use it in GitHub Desktop.
Save tyler6699/c2e827a19696d97be11ea0d4fb701668 to your computer and use it in GitHub Desktop.
Grunt file and NPM package file for compressing and obfuscating JS13KB Game
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
mangle: {
toplevel: true,
eval: true,
keep_fnames: false,
reserved: ["startGame"]
}
},
build: {
files: [{
expand: false,
src: 'assets/js/*.js',
dest: 'dst/game.min.js',
ext: '.min.js'
}]
}
},
watch: {
files: ['assets/js/*.js'],
tasks: ['uglify']
}
});
grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['uglify']);
};
{
"name": "grunt-getting-started",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.4",
"grunt-contrib-uglify-es": "latest",
"grunt-contrib-less": "latest",
"grunt-contrib-cssmin": "latest",
"grunt-contrib-watch": "latest"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment