diff --git a/Gruntfile.js b/Gruntfile.js index bb8c95df2678b..95d372f0fa6f2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -7,390 +7,25 @@ module.exports = function (grunt) { srcDir: 'src', destDir: 'dist', tempDir: 'tmp', - meta: { - banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + - '<%= grunt.template.today("yyyy-mm-dd") %>\n' + - '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' + - ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + - ' Licensed <%= pkg.license %> */\n\n' - }, - clean: { - on_start: ['<%= destDir %>', '<%= tempDir %>'], - temp: ['<%= tempDir %>'], - }, - less: { - // this is the only task, other than copy, that runs on the src directory, since we don't really need - // the less files in the dist. Everything else runs from on temp, and require copys everything - // from temp -> dist - dist:{ - expand: true, - cwd:'<%= srcDir %>/vendor/bootstrap/less/', - src: ['bootstrap.dark.less', 'bootstrap.light.less'], - dest: '<%= tempDir %>/css/', - }, - // Compile in place when not building - src:{ - options: { - paths: ["<%= srcDir %>/vendor/bootstrap/less"], - yuicompress:true - }, - files: { - "<%= srcDir %>/css/bootstrap.dark.min.css": "<%= srcDir %>/vendor/bootstrap/less/bootstrap.dark.less", - "<%= srcDir %>/css/bootstrap.light.min.css": "<%= srcDir %>/vendor/bootstrap/less/bootstrap.light.less" - } - } - }, - copy: { - // copy source to temp, we will minify in place for the dist build - everything_but_less_to_temp: { - cwd: '<%= srcDir %>', - expand: true, - src: ['**/*', '!**/*.less'], - dest: '<%= tempDir %>' - } - }, - jshint: { - // just lint the source dir - source: { - files: { - src: ['Gruntfile.js', '<%= srcDir %>/app/**/*.js'] - } - }, - options: { - jshintrc: '.jshintrc' - } - }, - htmlmin:{ - build: { - options:{ - removeComments: true, - collapseWhitespace: true - }, - expand: true, - cwd: '<%= tempDir %>', - src: [ - 'index.html', - 'app/panels/**/*.html', - 'app/partials/**/*.html' - ], - dest: '<%= tempDir %>' - } - }, - cssmin: { - build: { - expand: true, - cwd: '<%= tempDir %>', - src: '**/*.css', - dest: '<%= tempDir %>' - } - }, - ngmin: { - build: { - expand:true, - cwd:'<%= tempDir %>', - src: [ - 'app/controllers/**/*.js', - 'app/directives/**/*.js', - 'app/services/**/*.js', - 'app/filters/**/*.js', - 'app/panels/**/*.js', - 'app/app.js', - 'vendor/angular/**/*.js', - 'vendor/elasticjs/elastic-angular-client.js' - ], - dest: '<%= tempDir %>' - } - }, - requirejs: { - build: { - options: { - appDir: '<%= tempDir %>', - dir: '<%= destDir %>', - - mainConfigFile: '<%= tempDir %>/app/components/require.config.js', - modules: [], // populated below - - optimize: 'none', - optimizeCss: 'none', - optimizeAllPluginResources: false, - - removeCombined: true, - findNestedDependencies: true, - normalizeDirDefines: 'all', - inlineText: true, - skipPragmas: true, - - done: function (done, output) { - var duplicates = require('rjs-build-analysis').duplicates(output); - - if (duplicates.length > 0) { - grunt.log.subhead('Duplicates found in requirejs build:'); - grunt.log.warn(duplicates); - done(new Error('r.js built duplicate modules, please check the excludes option.')); - } - - done(); - } - } - } - }, - uglify: { - dest: { - expand: true, - src: ['**/*.js', '!config.js', '!app/dashboards/*.js'], - dest: '<%= destDir %>', - cwd: '<%= destDir %>', - options: { - quite: true, - compress: true, - preserveComments: false, - banner: '<%= meta.banner %>' - } - } - }, - 'git-describe': { - me: { - // Target-specific file lists and/or options go here. - }, - }, - compress: { - zip: { - options: { - archive: '<%= tempDir %>/<%= pkg.name %>-latest.zip' - }, - files : [ - { - expand: true, - cwd: '<%= destDir %>', - src: ['**/*'], - dest: '<%= pkg.name %>-latest' - }, - { - expand: true, - src: ['LICENSE.md', 'README.md'], - dest: '<%= pkg.name %>-latest' - } - ] - }, - tgz: { - options: { - archive: '<%= tempDir %>/<%= pkg.name %>-latest.tar.gz' - }, - files : [ - { - expand: true, - cwd: '<%= destDir %>', - src: ['**/*'], - dest: '<%= pkg.name %>-latest' - }, - { - expand: true, - src: ['LICENSE.md', 'README.md'], - dest: '<%= pkg.name %>-latest' - } - ] - }, - zip_release: { - options: { - archive: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.zip' - }, - files : [ - { - expand: true, - cwd: '<%= destDir %>', - src: ['**/*'], - dest: '<%= pkg.name %>-<%= pkg.version %>' - }, - { - expand: true, - src: ['LICENSE.md', 'README.md'], - dest: '<%= pkg.name %>-<%= pkg.version %>' - } - ] - }, - tgz_release: { - options: { - archive: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz' - }, - files : [ - { - expand: true, - cwd: '<%= destDir %>', - src: ['**/*'], - dest: '<%= pkg.name %>-<%= pkg.version %>' - }, - { - expand: true, - src: ['LICENSE.md', 'README.md'], - dest: '<%= pkg.name %>-<%= pkg.version %>' - } - ] - } - }, - s3: { - dist: { - bucket: 'download.elasticsearch.org', - access: 'private', - // debug: true, // uncommment to prevent actual upload - upload: [ - { - src: '<%= tempDir %>/<%= pkg.name %>-latest.zip', - dest: 'kibana/kibana/<%= pkg.name %>-latest.zip', - }, - { - src: '<%= tempDir %>/<%= pkg.name %>-latest.tar.gz', - dest: 'kibana/kibana/<%= pkg.name %>-latest.tar.gz', - } - ] - }, - release: { - bucket: 'download.elasticsearch.org', - access: 'private', - // debug: true, // uncommment to prevent actual upload - upload: [ - { - src: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.zip', - dest: 'kibana/kibana/<%= pkg.name %>-<%= pkg.version %>.zip', - }, - { - src: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz', - dest: 'kibana/kibana/<%= pkg.name %>-<%= pkg.version %>.tar.gz', - } - ] - } - } }; - // setup the modules require will build - var requireModules = config.requirejs.build.options.modules = [ - { - // main/common module - name: 'app', - include: [ - 'css', - 'kbn', - 'text', - 'jquery', - 'angular', - 'settings', - 'bootstrap', - 'modernizr', - 'elasticjs', - 'timepicker', - 'datepicker', - 'underscore', - 'filters/all', - 'jquery.flot', - 'services/all', - 'angular-strap', - 'directives/all', - 'jquery.flot.pie', - 'angular-sanitize', - 'angular-dragdrop' - ] - } - ]; - - // create a module for each directory in src/app/panels/ - require('fs') - .readdirSync(config.srcDir+'/app/panels') - .forEach(function (panelName) { - requireModules.push({ - name: 'panels/'+panelName+'/module', - exclude: ['app'] - }); - }); - - // exclude the literal config definition from all modules - requireModules - .forEach(function (module) { - module.excludeShallow = module.excludeShallow || []; - module.excludeShallow.push('config'); - }); - - // Run jshint - grunt.registerTask('default', ['jshint:source', 'less:src']); - - // Concat and Minify the src directory into dist - grunt.registerTask('build', [ - 'jshint:source', - 'clean:on_start', - 'less:dist', - 'copy:everything_but_less_to_temp', - 'htmlmin:build', - 'cssmin:build', - 'ngmin:build', - 'requirejs:build', - 'clean:temp', - 'build:write_revision', - 'uglify:dest' - ]); - - // run a string replacement on the require config, using the latest revision number as the cache buster - grunt.registerTask('build:write_revision', function() { - grunt.event.once('git-describe', function (desc) { - grunt.config('string-replace.config', { - src: '<%= destDir %>/app/components/require.config.js', - dest: '<%= destDir %>/app/components/require.config.js', - options: { - replacements: [ - { - pattern: /(?:^|\/\/)(.*)@REV@/, - replacement: '$1'+desc.object - } - ] - } - }); - - grunt.task.run('string-replace:config'); - }); - grunt.task.run('git-describe'); - }); - - // build, then zip and upload to s3 - grunt.registerTask('distribute', [ - 'distribute:load_s3_config', - 'build', - 'compress:zip', - 'compress:tgz', - 's3:dist', - 'clean:temp' - ]); + // load plugins + require('load-grunt-tasks')(grunt); - // build, then zip and upload to s3 - grunt.registerTask('release', [ - 'distribute:load_s3_config', - 'build', - 'compress:zip_release', - 'compress:tgz_release', - 's3:release', - 'clean:temp' - ]); + // load task definitions + grunt.loadTasks('tasks'); - // collect the key and secret from the .aws-config.json file, finish configuring the s3 task - grunt.registerTask('distribute:load_s3_config', function () { - var config = grunt.file.readJSON('.aws-config.json'); - grunt.config('s3.options', { - key: config.key, - secret: config.secret + // Utility function to load plugin configurations into an object + function loadConfig(path) { + var object = {}; + require('glob').sync('*', {cwd: path}).forEach(function(option) { + object[option.replace(/\.js$/,'')] = require(path + option)(config); }); - }); - - // load plugins - grunt.loadNpmTasks('grunt-s3'); - grunt.loadNpmTasks('grunt-ngmin'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-less'); - grunt.loadNpmTasks('grunt-git-describe'); - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-string-replace'); - grunt.loadNpmTasks('grunt-contrib-htmlmin'); - grunt.loadNpmTasks('grunt-contrib-requirejs'); - grunt.loadNpmTasks('grunt-contrib-compress'); + return object; + } + // Merge that object with what with whatever we have here + grunt.util._.extend(config, loadConfig('./tasks/options/')); // pass the config to grunt grunt.initConfig(config); diff --git a/package.json b/package.json index b3868556d7c05..c4e76d7966037 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ "grunt-contrib-requirejs": "~0.4.1", "grunt-angular-templates": "~0.3.12", "grunt-contrib-compress": "~0.5.2", - "grunt-contrib-uglify": "~0.2.4" + "grunt-contrib-uglify": "~0.2.4", + "load-grunt-tasks": "~0.2.0", + "glob": "~3.2.7" }, "license": "Apache License" } diff --git a/tasks/build_task.js b/tasks/build_task.js new file mode 100644 index 0000000000000..23e2db359823a --- /dev/null +++ b/tasks/build_task.js @@ -0,0 +1,38 @@ +module.exports = function(grunt) { + + // Concat and Minify the src directory into dist + grunt.registerTask('build', [ + 'jshint:source', + 'clean:on_start', + 'less:dist', + 'copy:everything_but_less_to_temp', + 'htmlmin:build', + 'cssmin:build', + 'ngmin:build', + 'requirejs:build', + 'clean:temp', + 'build:write_revision', + 'uglify:dest' + ]); + + // run a string replacement on the require config, using the latest revision number as the cache buster + grunt.registerTask('build:write_revision', function() { + grunt.event.once('git-describe', function (desc) { + grunt.config('string-replace.config', { + src: '<%= destDir %>/app/components/require.config.js', + dest: '<%= destDir %>/app/components/require.config.js', + options: { + replacements: [ + { + pattern: /(?:^|\/\/)(.*)@REV@/, + replacement: '$1'+desc.object + } + ] + } + }); + + grunt.task.run('string-replace:config'); + }); + grunt.task.run('git-describe'); + }); +} \ No newline at end of file diff --git a/tasks/default_task.js b/tasks/default_task.js new file mode 100644 index 0000000000000..c81cf9ba6108f --- /dev/null +++ b/tasks/default_task.js @@ -0,0 +1,4 @@ +// Lint and build CSS +module.exports = function(grunt) { + grunt.registerTask('default', ['jshint:source', 'less:src']); +}; \ No newline at end of file diff --git a/tasks/distribute_task.js b/tasks/distribute_task.js new file mode 100644 index 0000000000000..812cf8a19eb3d --- /dev/null +++ b/tasks/distribute_task.js @@ -0,0 +1,31 @@ +module.exports = function(grunt) { + + // build, then zip and upload to s3 + grunt.registerTask('distribute', [ + 'distribute:load_s3_config', + 'build', + 'compress:zip', + 'compress:tgz', + 's3:dist', + 'clean:temp' + ]); + + // build, then zip and upload to s3 + grunt.registerTask('release', [ + 'distribute:load_s3_config', + 'build', + 'compress:zip_release', + 'compress:tgz_release', + 's3:release', + 'clean:temp' + ]); + + // collect the key and secret from the .aws-config.json file, finish configuring the s3 task + grunt.registerTask('distribute:load_s3_config', function () { + var config = grunt.file.readJSON('.aws-config.json'); + grunt.config('s3.options', { + key: config.key, + secret: config.secret + }); + }); +} \ No newline at end of file diff --git a/tasks/options/clean.js b/tasks/options/clean.js new file mode 100644 index 0000000000000..e1624ebae7435 --- /dev/null +++ b/tasks/options/clean.js @@ -0,0 +1,6 @@ +module.exports = function(config) { + return { + on_start: ['<%= destDir %>', '<%= tempDir %>'], + temp: ['<%= tempDir %>'], + }; +}; \ No newline at end of file diff --git a/tasks/options/compress.js b/tasks/options/compress.js new file mode 100644 index 0000000000000..5738ce17ae793 --- /dev/null +++ b/tasks/options/compress.js @@ -0,0 +1,76 @@ +module.exports = function(config) { + return { + zip: { + options: { + archive: '<%= tempDir %>/<%= pkg.name %>-latest.zip' + }, + files : [ + { + expand: true, + cwd: '<%= destDir %>', + src: ['**/*'], + dest: '<%= pkg.name %>-latest' + }, + { + expand: true, + src: ['LICENSE.md', 'README.md'], + dest: '<%= pkg.name %>-latest' + } + ] + }, + tgz: { + options: { + archive: '<%= tempDir %>/<%= pkg.name %>-latest.tar.gz' + }, + files : [ + { + expand: true, + cwd: '<%= destDir %>', + src: ['**/*'], + dest: '<%= pkg.name %>-latest' + }, + { + expand: true, + src: ['LICENSE.md', 'README.md'], + dest: '<%= pkg.name %>-latest' + } + ] + }, + zip_release: { + options: { + archive: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.zip' + }, + files : [ + { + expand: true, + cwd: '<%= destDir %>', + src: ['**/*'], + dest: '<%= pkg.name %>-<%= pkg.version %>' + }, + { + expand: true, + src: ['LICENSE.md', 'README.md'], + dest: '<%= pkg.name %>-<%= pkg.version %>' + } + ] + }, + tgz_release: { + options: { + archive: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz' + }, + files : [ + { + expand: true, + cwd: '<%= destDir %>', + src: ['**/*'], + dest: '<%= pkg.name %>-<%= pkg.version %>' + }, + { + expand: true, + src: ['LICENSE.md', 'README.md'], + dest: '<%= pkg.name %>-<%= pkg.version %>' + } + ] + } + }; +}; \ No newline at end of file diff --git a/tasks/options/copy.js b/tasks/options/copy.js new file mode 100644 index 0000000000000..2abb6fdf01c9f --- /dev/null +++ b/tasks/options/copy.js @@ -0,0 +1,11 @@ +module.exports = function(config) { + return { + // copy source to temp, we will minify in place for the dist build + everything_but_less_to_temp: { + cwd: '<%= srcDir %>', + expand: true, + src: ['**/*', '!**/*.less'], + dest: '<%= tempDir %>' + } + }; +}; \ No newline at end of file diff --git a/tasks/options/cssmin.js b/tasks/options/cssmin.js new file mode 100644 index 0000000000000..b049a383fcab3 --- /dev/null +++ b/tasks/options/cssmin.js @@ -0,0 +1,10 @@ +module.exports = function(config) { + return { + build: { + expand: true, + cwd: '<%= tempDir %>', + src: '**/*.css', + dest: '<%= tempDir %>' + } + }; +}; \ No newline at end of file diff --git a/tasks/options/git-describe.js b/tasks/options/git-describe.js new file mode 100644 index 0000000000000..44df7ac5f74d6 --- /dev/null +++ b/tasks/options/git-describe.js @@ -0,0 +1,7 @@ +module.exports = function(config) { + return { + me: { + // Target-specific file lists and/or options go here. + } + }; +}; \ No newline at end of file diff --git a/tasks/options/htmlmin.js b/tasks/options/htmlmin.js new file mode 100644 index 0000000000000..602fc1db04281 --- /dev/null +++ b/tasks/options/htmlmin.js @@ -0,0 +1,18 @@ +module.exports = function(config) { + return { + build: { + options:{ + removeComments: true, + collapseWhitespace: true + }, + expand: true, + cwd: '<%= tempDir %>', + src: [ + 'index.html', + 'app/panels/**/*.html', + 'app/partials/**/*.html' + ], + dest: '<%= tempDir %>' + } + }; +}; \ No newline at end of file diff --git a/tasks/options/jshint.js b/tasks/options/jshint.js new file mode 100644 index 0000000000000..59980f2a317b8 --- /dev/null +++ b/tasks/options/jshint.js @@ -0,0 +1,13 @@ +module.exports = function(config) { + return { + // just lint the source dir + source: { + files: { + src: ['Gruntfile.js', '<%= srcDir %>/app/**/*.js'] + } + }, + options: { + jshintrc: '.jshintrc' + } + }; +}; \ No newline at end of file diff --git a/tasks/options/less.js b/tasks/options/less.js new file mode 100644 index 0000000000000..872650dbec32d --- /dev/null +++ b/tasks/options/less.js @@ -0,0 +1,24 @@ +module.exports = function(config) { + return { + // this is the only task, other than copy, that runs on the src directory, since we don't really need + // the less files in the dist. Everything else runs from on temp, and require copys everything + // from temp -> dist + dist:{ + expand: true, + cwd:'<%= srcDir %>/vendor/bootstrap/less/', + src: ['bootstrap.dark.less', 'bootstrap.light.less'], + dest: '<%= tempDir %>/css/', + }, + // Compile in place when not building + src:{ + options: { + paths: ["<%= srcDir %>/vendor/bootstrap/less"], + yuicompress:true + }, + files: { + "<%= srcDir %>/css/bootstrap.dark.min.css": "<%= srcDir %>/vendor/bootstrap/less/bootstrap.dark.less", + "<%= srcDir %>/css/bootstrap.light.min.css": "<%= srcDir %>/vendor/bootstrap/less/bootstrap.light.less" + } + } + }; +}; \ No newline at end of file diff --git a/tasks/options/meta.js b/tasks/options/meta.js new file mode 100644 index 0000000000000..3792f116faa61 --- /dev/null +++ b/tasks/options/meta.js @@ -0,0 +1,9 @@ +module.exports = function(config) { + return { + banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + + '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' + + ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed <%= pkg.license %> */\n\n' + }; +}; \ No newline at end of file diff --git a/tasks/options/ngmin.js b/tasks/options/ngmin.js new file mode 100644 index 0000000000000..d4d2542bcce8a --- /dev/null +++ b/tasks/options/ngmin.js @@ -0,0 +1,19 @@ +module.exports = function(config) { + return { + build: { + expand:true, + cwd:'<%= tempDir %>', + src: [ + 'app/controllers/**/*.js', + 'app/directives/**/*.js', + 'app/services/**/*.js', + 'app/filters/**/*.js', + 'app/panels/**/*.js', + 'app/app.js', + 'vendor/angular/**/*.js', + 'vendor/elasticjs/elastic-angular-client.js' + ], + dest: '<%= tempDir %>' + } + }; +}; \ No newline at end of file diff --git a/tasks/options/requirejs.js b/tasks/options/requirejs.js new file mode 100644 index 0000000000000..663a1d58d952d --- /dev/null +++ b/tasks/options/requirejs.js @@ -0,0 +1,84 @@ +module.exports = function(config) { + var _c = { + build: { + options: { + appDir: '<%= tempDir %>', + dir: '<%= destDir %>', + + mainConfigFile: '<%= tempDir %>/app/components/require.config.js', + modules: [], // populated below + + optimize: 'none', + optimizeCss: 'none', + optimizeAllPluginResources: false, + + removeCombined: true, + findNestedDependencies: true, + normalizeDirDefines: 'all', + inlineText: true, + skipPragmas: true, + + done: function (done, output) { + var duplicates = require('rjs-build-analysis').duplicates(output); + + if (duplicates.length > 0) { + grunt.log.subhead('Duplicates found in requirejs build:'); + grunt.log.warn(duplicates); + done(new Error('r.js built duplicate modules, please check the excludes option.')); + } + + done(); + } + } + } + }; + + // setup the modules require will build + var requireModules = _c.build.options.modules = [ + { + // main/common module + name: 'app', + include: [ + 'css', + 'kbn', + 'text', + 'jquery', + 'angular', + 'settings', + 'bootstrap', + 'modernizr', + 'elasticjs', + 'timepicker', + 'datepicker', + 'underscore', + 'filters/all', + 'jquery.flot', + 'services/all', + 'angular-strap', + 'directives/all', + 'jquery.flot.pie', + 'angular-sanitize', + 'angular-dragdrop' + ] + } + ]; + + // create a module for each directory in src/app/panels/ + require('fs') + .readdirSync(config.srcDir+'/app/panels') + .forEach(function (panelName) { + requireModules.push({ + name: 'panels/'+panelName+'/module', + exclude: ['app'] + }); + }); + + // exclude the literal config definition from all modules + requireModules + .forEach(function (module) { + module.excludeShallow = module.excludeShallow || []; + module.excludeShallow.push('config'); + }); + + return _c; +}; diff --git a/tasks/options/s3.js b/tasks/options/s3.js new file mode 100644 index 0000000000000..d41ed57a2e5fa --- /dev/null +++ b/tasks/options/s3.js @@ -0,0 +1,34 @@ +module.exports = function(config) { + return { + dist: { + bucket: 'download.elasticsearch.org', + access: 'private', + // debug: true, // uncommment to prevent actual upload + upload: [ + { + src: '<%= tempDir %>/<%= pkg.name %>-latest.zip', + dest: 'kibana/kibana/<%= pkg.name %>-latest.zip', + }, + { + src: '<%= tempDir %>/<%= pkg.name %>-latest.tar.gz', + dest: 'kibana/kibana/<%= pkg.name %>-latest.tar.gz', + } + ] + }, + release: { + bucket: 'download.elasticsearch.org', + access: 'private', + // debug: true, // uncommment to prevent actual upload + upload: [ + { + src: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.zip', + dest: 'kibana/kibana/<%= pkg.name %>-<%= pkg.version %>.zip', + }, + { + src: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz', + dest: 'kibana/kibana/<%= pkg.name %>-<%= pkg.version %>.tar.gz', + } + ] + } + }; +}; \ No newline at end of file diff --git a/tasks/options/uglify.js b/tasks/options/uglify.js new file mode 100644 index 0000000000000..35ef5a81d1186 --- /dev/null +++ b/tasks/options/uglify.js @@ -0,0 +1,16 @@ +module.exports = function(config) { + return { + dest: { + expand: true, + src: ['**/*.js', '!config.js', '!app/dashboards/*.js'], + dest: '<%= destDir %>', + cwd: '<%= destDir %>', + options: { + quite: true, + compress: true, + preserveComments: false, + banner: '<%= meta.banner %>' + } + } + }; +}; \ No newline at end of file