Last active
December 14, 2015 19:59
-
-
Save Johnqing/5140671 to your computer and use it in GitHub Desktop.
Revisions
-
Johnqing revised this gist
Mar 13, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ "grunt-contrib-concat": "~0.1.1" } } 6.在项目根目录运行命令: npm install (不带模块名会安装一些基础模块,npm install xx --save-dev) 7.查看项目中node_modules目录,是否包含 grunt grunt-contrib-concat -
Johnqing revised this gist
Mar 12, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,6 +37,8 @@ }); //载入concat模块 grunt.loadNpmTasks('grunt-contrib-concat'); // 注册任务(0.4后貌似需要[]来添加注册模块) grunt.registerTask('default', ['concat']); } 9.运行命令:grunt,显示如下: Running "default" task -
Johnqing renamed this gist
Mar 12, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Johnqing created this gist
Mar 12, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ (注意:本教程前提为未安装gruntjs其他版本,如果安装请删除!) 1.安装node(在此不做介绍) 2.运行命令: npm install -g grunt-cli(-g为全局安装,可在任何目录运行) 3.进入项目目录,运行命令: npm install grunt --save-dev 4.查看是否安装成功 grunt -version 成功显示: grunt-cli v0.1.6 grunt v0.4.0 5.新建package.json 如下: { "name": "51", "version": "0.1.0", "devDependencies": { "grunt": "~0.4.0", "grunt-contrib-jshint": "~0.1.1", "grunt-contrib-uglify": "~0.1.2", "grunt-contrib-concat": "~0.1.1" } } 6.在项目根目录运行命令: npm install 7.查看项目中node_modules目录,是否包含 grunt grunt-contrib-concat grunt-contrib-jshint grunt-contrib-uglify 8.新建Gruntfile.js,结构如下: module.exports = function(grunt) { grunt.initConfig({ concat: { options: { separator: ';' }, dist: { src: ['assets/seajs/seajs.js', assets/init/config.js', 'assets/init/main.js', 'assets/init/category.js', 'assets/init/fimg.js', 'assets/init/lazyload.js'], dest: 'dist/built.js' } } }); //载入concat模块 grunt.loadNpmTasks('grunt-contrib-concat'); } 9.运行命令:grunt,显示如下: Running "default" task default Done, without errors. 10.完成。