grunt学习笔记
1. 在使用grunt前需要执行的几条命令和用途
npm uninstall -g grunt 删除掉全局grunt
npm install -g grunt-cli 把grunt加入你的系统搜索路径中
npm init 自动创建一个基本的 package.json 文件
npm install <module> --save-dev 安装一个grunt插件,并在package.json文件中将它添加到devDependencies属性中(目前尚不清楚devDependencies和dependencies的区别)
2. 错误处理
RangeError: Maximum call stack size exceeded
此报错是在定义grunt任务时不能将任务名与插件起一样的名字,例如:grunt.registerTask(‘concat’, ['concat:build']);
Warning: Task “builduglify” not found. Use –force to continue.
此报错是在定义grunt任务时格式有误,我是少写了一个逗号产生的错误,grunt.registerTask(‘builduglify’, ['uglify:build']);
Cannot find module 'github-url-from-git'
可以执行下npm cache clean试一下
3. 创建动态文件时,flatten属性的意思是使src的文件在dest中去除路径,只保留文件。