Why use a task runner?



In one word: automation. The less work you have to do when performing repetitive tasks like minification, compilation, unit testing, linting, etc, the easier your job becomes. After you've configured it, a task runner can do most of that mundane work for you—and your team—with basically zero effort.

Who uses


Title

install

$ npm install -g grunt-climkdir tmpcd tmptouch package.json{
    "name": "hello",
    "version": "0.0.1",
    "description": "iefree grunt demo",
    "author": "char1ee",
    "dependencies": {
    },
    "devDependencies": {
       
    }
}
npm install grunt --save-dev


config

touch Gruntfile.jsmodule.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        src: 'src/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>.min.js'
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.registerTask('default', ['uglify']);

};


config

example

uglifyjs  
less
watch
jshint

grunt

By Charlee Green

grunt

  • 401