Grunt安装与使用

Grunt项目的源代码

https://github.com/gruntjs/grunt-cli

在Windows命令行下面使用

PS E:DevDev2015> npm install -g grunt-cli

打开一个已经存在的项目

如果grunt-cli已经被安装,并且存在一个项目已使用package.json和Gruntfile配置,使用Grunt打开该项目,很简单

1.切换到项目根目录

2.执行npm install

3.运行grunt

下面以打开Bootstrap项目为演示

我们知道Bootstrap项目是使用Grunt作为编译系统的,所有当然可以使用Grunt打开它

进入项目目录

E:> cd .DevDev2015Gruntootstrap-3.3.2

执行npm install

 npm install

重新构建所有内容

PS E:DevDev2015Gruntootstrap-3.3.2> grunt
>> Local Npm module "grunt-contrib-qunit" not found. Is it installed?

Running "clean:dist" (clean) task
>> 1 path cleaned.

Running "copy:fonts" (copy) task
Copied 5 files

Running "less:compileCore" (less) task
File dist/css/bootstrap.css.map created.
File dist/css/bootstrap.css created

Running "less:compileTheme" (less) task
File dist/css/bootstrap-theme.css.map created.
File dist/css/bootstrap-theme.css created

创建新项目 

一个典型的安装包含两个文件:package.json和Gruntfile.js

原文地址:https://www.cnblogs.com/tao-zi/p/4310898.html