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的更多相关文章

  1. 【grunt整合版】学会使用grunt打包前端代码

    grunt 是一套前端自动化工具,一个基于nodeJs的命令行工具,一般用于:① 压缩文件② 合并文件③ 简单语法检查 对于其他用法,我还不太清楚,我们这里简单介绍下grunt的压缩.合并文件,初学, ...

  2. grunt使用小记之开篇:grunt概述

    Grunt是什么? Grunt是一个自动化的项目构建工具.如果你需要重复的执行像压缩,编译,单元测试,代码检查以及打包发布的任务.那么你可以使用Grunt来处理这些任务,你所需要做的只是配置好Grun ...

  3. 安装完grunt和grunt-cli仍然无法识别grunt

    如题: 在安装完grunt-cli和grunt之后,仍然不识别grunt. 反复确认是-g安装... 原因: 有可能是nodejs安装出现问题,到时npm的路径没有出现在环境变量里面. 把C:\Use ...

  4. 构建seajs业务模块之grunt VS spm build

    在最开始,我并不知道grunt可以构建CMD模块.(以下spm指代spm build) 当时正困惑于如何用spm方便的构建业务模块,后来看到@twinstony (感谢@twinstony的分享)使用 ...

  5. grunt 构建工具(build tool)初体验

    操作环境:win8 系统,建议使用 git bash (window下的命令行工具) 1,安装node.js 官网下载:https://nodejs.org/  直接点击install ,会根据你的操 ...

  6. grunt 安装使用(一)

    grunt 依赖nodejs,所有在使用前确保你安装了nodejs,然后开始执行grunt命令. .安装node nodejs安装教程 安装完成后在命令行,执行命令: node  -v 出现版本信息, ...

  7. ios 常见问题解决

    一,libxml/HTMLparser.h file not find 第一种方法: 点击左边项目的根目录,再点击右边的Build Settings,手工输入文字:“Header search pat ...

  8. 杂项-Grunt:grunt build 打包和常见错误

    ylbtech-杂项-Grunt:grunt build 打包和常见错误 1. 安装.打包返回顶部 1. npm WARN deprecated coffee-script@: CoffeeScrip ...

  9. Grunt Part 2

    Objectives and Outcomes In this exercise, you will continue to learn to use Grunt, the task runner. ...

随机推荐

  1. Python并发编程-进程的几个方法

    join()方法 from multiprocessing import Process import time def func(arg1,arg2): print('*'*arg1) time.s ...

  2. scrapy抓取拉勾网职位信息(六)——反爬应对(随机UA,随机代理)

    上篇已经对数据进行了清洗,本篇对反爬虫做一些应对措施,主要包括随机UserAgent.随机代理. 一.随机UA 分析:构建随机UA可以采用以下两种方法 我们可以选择很多UserAgent,形成一个列表 ...

  3. 第9天-BOM和DOM

    什么是DOM 文档对象模型(Document Object Model),DOM作用:可以去修改网页内容.样式.结构. 每个浏览器都会把html文档解析成dom树,就可以用相关方法和属性操作网页元素 ...

  4. 选项卡栏控制器(UITabBarController)

    选项卡栏控制器管理的每个场景都包含一个UITabBarItem,它包含标题.图像和徽章. 在场景里可以通过tabBarItem属性来获得UITabBarItem的引用.例如:[self.tabBarI ...

  5. Scrapy实战篇(五)爬取京东商城文胸信息

    创建scrapy项目 scrapy startproject jingdong 填充 item.py文件 在这里定义想要存储的字段信息 import scrapy class JingdongItem ...

  6. FastReport.Net使用:[14]文本控件使用

    文本控件(Text)是FastReport中最常用的控件了,它可以是一行\多行文本.数据源的列.报表参数.汇总值.表达式,它还可以是以上任何元素的组合. 如何使用文本编辑器 1.双击文本框进入文本编辑 ...

  7. 51nod1821 最优集合 贪心

    首先考虑一个集合的最大优美值怎么求出 考虑新增一个数,假设我们现在的优美值已经达到了$V$,那么只需要一个$[1, V + 1]$的数就可以使$V$达到更大 为了保证能添加尽可能多的数进来,我们这么构 ...

  8. HDU3853 LOOPS 期望DP 简单

    http://acm.hdu.edu.cn/showproblem.php?pid=3853 有一点坑的地方是如果一个地方停在原地的概率为1,那么该地的期望为0,就相当于这个地方也是一个出口...   ...

  9. [ARC051D]長方形

    [ARC051D]長方形 题目大意: 给定\(A_{1\sim n}\)和\(B_{1\sim m}(n,m\le2000,|A_i|,|B_i|\le10^5)\),矩阵\(C_{i,j}=A_i+ ...

  10. [转]runOnUiThread 、 Handler 对比(一)

      this.runOnUiThread(new Runnable() { @Override public void run() { try { Thread.sleep(1000 * 5); }  ...