// Whole Gruntfile.js so far module.exports = function(grunt) { // 1. All configuration goes here grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), banner: '/*\n' + ' * <%= pkg.name %> <%= pkg.version %>\n' + ' * <%= pkg.description %>\n' + ' *\n' + ' * <%= pkg.homepage %>\n' + ' *\n' + ' * Copyright 2013-<%= grunt.template.today("yyyy") %>, <%= pkg.author %>\n' + ' * Released on: <%= grunt.template.today("mmmm d, yyyy") %>\n' + '*/\n', jshint: { // define the files to lint files: ['gruntfile.js', 'js/*.js', '!js/jquery*.js'], // configure JSHint (documented at http://www.jshint.com/docs/) options: { // more options here if you want to override JSHint defaults globals: { jQuery: true, console: true, module: true } } }, clean: { src: ["dist"], }, uglify: { options: { report: 'gzip', compress: true, banner: '<%= banner %>', }, mangle: {toplevel: false}, squeeze: {dead_code: false}, codegen: {quote_keys: true}, dist: { files: { '<%= pkg.dirs.js.dist.min %>':'<%= pkg.dirs.js.dist.src %>' } } }, compress: { main: { options: { mode: 'gzip', level: 9 }, files: [ {expand: true, cwd: 'dist/', src: ['app.js', 'style.css'], dest: 'dist/zip/'} ] } }, concat: { js: { options: { banner: '<%= banner %>', stripBanners: true, separator: ';\n' }, src: '<%= pkg.dirs.js.dev %>', dest: '<%= pkg.dirs.js.dist.src %>' }, css:{ options: { banner: '<%= banner %>', stripBanners: true, separator: ' \n' }, src: '<%= pkg.dirs.css.dev %>', dest: '<%= pkg.dirs.css.dist.src %>' } }, cssmin: { options: { banner: '<%= banner %>', stripBanners: true, separator: ' \n', keepSpecialComments: 0 }, dist: { files: { '<%= pkg.dirs.css.dist.min %>':'<%= pkg.dirs.css.dist.src %>' } } }, shell: { echo: { command: 'echo 1', options: { stdout: true, failOnError: true } }, clean: { command: 'rm dist -r', options: { stdout: true, failOnError: true } }, pull: { command: function(pr) { return [ 'git checkout .', //in case of any change 'git pull' ].join('&&'); }, options: { stdout: true, failOnError: true } }, amend: { command: 'git commit -a --amend --no-edit', options: { stdout: true, failOnError: true } } } }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-compress'); //gzip grunt.loadNpmTasks('grunt-shell'); //git commands grunt.registerTask('default', ['shell:pull', 'clean', 'concat:js', 'uglify', 'concat:css', 'cssmin', 'compress']) };