Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Grunt

 Grunt

Introduction to grunt.js

lylijincheng

August 10, 2013
Tweet

More Decks by lylijincheng

Other Decks in Technology

Transcript

  1. 任务 • JSHint 检测代码质量 • Concat 合并 • Copy 复制

    • Minify 压缩 • Qunit 单元测试 • Source map 调试
  2. 安装插件 > npm install grunt-contrib-jshint --save-dev > npm install grunt-contrib-qunit

    --save-dev > npm install grunt-contrib-concat --save-dev > npm install grunt-contrib-uglify --save-dev > npm install grunt-contrib-watch --save-dev
  3. Gruntfile 结构 Gruntfile一般包括以下部分: • 外层包装函数 module.exports = function(grunt) {}; •

    项目和任务配置 grunt.initConfig(/* config */) • 加载插件和任务 grunt.loadNpmTasks(/* plugins */) • 自定义任务 grunt.registerTask(/* default tasks */)