mirror of
https://github.com/liabru/matter-js.git
synced 2025-01-21 17:14:38 -05:00
reduced dev build file size (chrome inspector was choking...)
This commit is contained in:
parent
9a2511dd50
commit
692b47f3eb
1 changed files with 26 additions and 8 deletions
34
Gruntfile.js
34
Gruntfile.js
|
@ -16,19 +16,35 @@ module.exports = function(grunt) {
|
|||
},
|
||||
pack: {
|
||||
options: {
|
||||
banner: '/**\n* <%= buildName %>.js <%= buildVersion %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n',
|
||||
banner: '/**\n* <%= buildName %>.js <%= buildVersion %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n'
|
||||
},
|
||||
src: ['src/module/Intro.js', 'build/<%= buildName %>.js', 'src/module/Outro.js'],
|
||||
dest: 'build/<%= buildName %>.js'
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '/**\n* <%= buildName %>.min.js <%= buildVersion %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n',
|
||||
},
|
||||
build: {
|
||||
min: {
|
||||
options: {
|
||||
banner: '/**\n* <%= buildName %>.min.js <%= buildVersion %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n'
|
||||
},
|
||||
src: 'build/<%= buildName %>.js',
|
||||
dest: 'build/<%= buildName %>.min.js'
|
||||
},
|
||||
dev: {
|
||||
options: {
|
||||
mangle: false,
|
||||
compress: false,
|
||||
preserveComments: false,
|
||||
beautify: {
|
||||
width: 32000,
|
||||
indent_level: 2,
|
||||
space_colon: false,
|
||||
beautify: true
|
||||
},
|
||||
banner: '/**\n* <%= buildName %>.min.js <%= buildVersion %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n'
|
||||
},
|
||||
src: 'build/<%= buildName %>.js',
|
||||
dest: 'build/<%= buildName %>.js'
|
||||
}
|
||||
},
|
||||
copy: {
|
||||
|
@ -98,26 +114,28 @@ module.exports = function(grunt) {
|
|||
var isDev = (mode === 'dev'),
|
||||
isRelease = (mode === 'release'),
|
||||
isEdge = (mode === 'edge'),
|
||||
pkg = grunt.file.readJSON('package.json');
|
||||
pkg = grunt.file.readJSON('package.json'),
|
||||
uglifyTask;
|
||||
|
||||
// development build mode
|
||||
if (isDev) {
|
||||
grunt.config.set('buildName', 'matter-dev');
|
||||
grunt.config.set('buildVersion', pkg.version + '-dev');
|
||||
grunt.task.run('concat', 'uglify:dev', 'uglify:min', 'copy');
|
||||
}
|
||||
|
||||
// release build mode
|
||||
if (isRelease) {
|
||||
grunt.config.set('buildName', 'matter-' + pkg.version);
|
||||
grunt.config.set('buildVersion', pkg.version + '-alpha');
|
||||
grunt.task.run('concat', 'uglify:min', 'copy');
|
||||
}
|
||||
|
||||
// edge build mode (default)
|
||||
if (isEdge || (!isDev && !isRelease)) {
|
||||
grunt.config.set('buildVersion', pkg.version + '-edge');
|
||||
grunt.task.run('concat', 'uglify:min', 'copy');
|
||||
}
|
||||
|
||||
grunt.task.run('concat', 'uglify', 'copy');
|
||||
});
|
||||
|
||||
grunt.registerTask('doc', function() {
|
||||
|
|
Loading…
Add table
Reference in a new issue