[Grunt] Cleaning your build folder with grunt-contrib-clean
Grunt will clean up your build with the grunt-contrib-clean to make sure that no artifacts from previous builds are hanging around.
Install:
npm install grunt-contrib-clean --save-dev
Example:
clean: {
build: 'build' //clean the build directory
}
Use:
grunt clean:build
Now we can put clean, concat and uglify together:
/**
* Created by Answer1215 on 11/16/2014.
*/
module.exports = function(grunt) {
grunt.initConfig({
stylus:{
compile:{
options: {
compress: false
},
files: {
"app/css/app.css": "styl/app.styl"
}
}
},
watch:{
stylus:{
files: ['styl/**/*.styl'],
tasks: ['stylus:compile']
},
css:{
options: {livereload: true},
files: ['app/css/**.css']
},
html:{
options: {livereload: true},
files: ['**.html']
},
script: {
options: {livereload: true},
files: ['app/js/**.js']
}
},
concat:{
options: {
separator: ';'
},
js:{
src: ['bower_components/angular/angular.min.js', 'app/js/app.js', 'app/js/**.js'],
dest: "build/app.js"
}
},
uglify: {
js: {
src: ["build/app.js"],
dest: "build/app.min.js"
}
},
clean: {
build: 'build' //clean the build directory
}
}); grunt.registerTask('build'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
}
[Grunt] Cleaning your build folder with grunt-contrib-clean的更多相关文章
- 【grunt整合版】学会使用grunt打包前端代码
grunt 是一套前端自动化工具,一个基于nodeJs的命令行工具,一般用于:① 压缩文件② 合并文件③ 简单语法检查 对于其他用法,我还不太清楚,我们这里简单介绍下grunt的压缩.合并文件,初学, ...
- grunt使用小记之开篇:grunt概述
Grunt是什么? Grunt是一个自动化的项目构建工具.如果你需要重复的执行像压缩,编译,单元测试,代码检查以及打包发布的任务.那么你可以使用Grunt来处理这些任务,你所需要做的只是配置好Grun ...
- 安装完grunt和grunt-cli仍然无法识别grunt
如题: 在安装完grunt-cli和grunt之后,仍然不识别grunt. 反复确认是-g安装... 原因: 有可能是nodejs安装出现问题,到时npm的路径没有出现在环境变量里面. 把C:\Use ...
- 构建seajs业务模块之grunt VS spm build
在最开始,我并不知道grunt可以构建CMD模块.(以下spm指代spm build) 当时正困惑于如何用spm方便的构建业务模块,后来看到@twinstony (感谢@twinstony的分享)使用 ...
- grunt 构建工具(build tool)初体验
操作环境:win8 系统,建议使用 git bash (window下的命令行工具) 1,安装node.js 官网下载:https://nodejs.org/ 直接点击install ,会根据你的操 ...
- grunt 安装使用(一)
grunt 依赖nodejs,所有在使用前确保你安装了nodejs,然后开始执行grunt命令. .安装node nodejs安装教程 安装完成后在命令行,执行命令: node -v 出现版本信息, ...
- ios 常见问题解决
一,libxml/HTMLparser.h file not find 第一种方法: 点击左边项目的根目录,再点击右边的Build Settings,手工输入文字:“Header search pat ...
- 杂项-Grunt:grunt build 打包和常见错误
ylbtech-杂项-Grunt:grunt build 打包和常见错误 1. 安装.打包返回顶部 1. npm WARN deprecated coffee-script@: CoffeeScrip ...
- Grunt Part 2
Objectives and Outcomes In this exercise, you will continue to learn to use Grunt, the task runner. ...
随机推荐
- CF815C Karen and Supermarket [树形DP]
题目传送门 Karen and Supermarket On the way home, Karen decided to stop by the supermarket to buy some gr ...
- 手机锁屏js倒计时停止问题解决办法探索
如图,有这么个需求,测试人员在测试过程中提了一个bug,手机锁屏再唤醒倒计时时间没有更新,仍从锁屏的时间继续,于是开始寻找解决之法 经了解得知,锁屏时候,浏览器的一切活动会停止运行,那么js也无法幸免 ...
- Unity 游戏开发技巧集锦之材质的应用的创建反射材质
Unity 游戏开发技巧集锦之材质的应用的创建反射材质 Unity中材质的应用 游戏中,大多数材质的应用都离不开纹理,而纹理本身是图片.所以,在学习本章时,最好在电脑上安装一个可以编辑图片的功能强大的 ...
- IDC、ICP、ISP区别
ICP( Internet Content Provider):网络内容服务商,即向广大用户综合提供互联网信息业务和增值业务的电信运营商.其必须具备的证书即为ICP证,如运营一个网站,需要进行备案获取 ...
- python 爬取世纪佳缘,经过js渲染过的网页的爬取
#!/usr/bin/python #-*- coding:utf-8 -*- #爬取世纪佳缘 #这个网站是真的烦,刚开始的时候用scrapy框架写,但是因为刚接触框架,碰到js渲染的页面之后就没办法 ...
- lightoj 1296 - Again Stone Game 博弈论
思路:由于数据很大,先通过打表找规律可以知道, 当n为偶数的时候其SG值为n/2; 当n为奇数的时候一直除2,直到为偶数m,则SG值为m/2; 代码如下: #include<stdio.h> ...
- bzoj 2821 分块
分块: 先预处理,将原序列分成长度为len的许多块,计算从第i块到第j块的答案,(可以做到O(n*n/len)). 每次询问时,将询问的区间分成三部分,:左边,中间,右边,中间是尽量大的一个块区间,其 ...
- 51nod 1010 只包含因子2 3 5的数 打表
只包含因子2 3 5的数 题目连接: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1010 Description K的 ...
- mysql中如何比较日期
做项目,需求是要做一个统计的功能,首次进入默认显示今天以及七天前的数据,这个很好解决. 然后就是用户点击日历插件选择日志,根据日期来统计当天的情况,我数据库里存的时间是使用的时间戳 前台获取到的日期是 ...
- TPS61040/61041 开关电源稳压器(DC-DC) ADJUST
Variable Control Voltage Output Voltage Adjust This method is accomplished by connecting a variable ...