[Grunt] External Config
Let's combine uglifying, watching, and config stuff into one Grunt file to make it more of a standard Grunt file.
Install:
npm install grunt
npm install grunt-contrib-watch
npm install grunt-contrib-uglify
Example:
/**
* Created by Answer1215 on 11/15/2014.
*/
module.exports = function(grunt){ // Version one
//grunt.initConfig({
//
// uglify:{
// dist:{
// files:{
// "dist/app.min.js": "app/**/*.js"
// }
// }
// },
// watch:{
// files:"app/**/*.js",
// tasks: 'uglify'
// }
//}); //version two: using template
//grunt.initConfig({
// conf: {
// input: "app/**/*.js"
// },
// uglify:{
// dist:{
// files:{
// "dist/app.min.js": "<%= conf.input %>"
// }
// }
// },
// watch:{
// files: "<%= conf.input %>",
// tasks: 'uglify'
// }
//}); //version three: using config json file grunt.initConfig({
conf: grunt.file.readJSON('config.json'),
uglify: {
dist:{
files:{
"dist/app.min.js": "<%= conf.input %>"
}
}
},
watch: {
files: "<%= conf.input %>",
tasks: ['uglify']
}
}); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
}
config.json
{
"input": "app/**/*.js"
}
[Grunt] External Config的更多相关文章
- scales小谈grunt
Grunt是基于Node.js的项目构建工具.它可以自动运行你所设定的任务.Grunt拥有数量庞大的插件,几乎任何你所要做的事情都可以用Grunt实现. 一头野猪映入眼帘,意:咕噜声 中文网站:htt ...
- NginX issues HTTP 499 error after 60 seconds despite config. (PHP and AWS)
FROM: http://stackoverflow.com/questions/15613452/nginx-issues-http-499-error-after-60-seconds-despi ...
- Grunt 实战
专题截图:(注:这个截图没啥意义) 项目截图: 目录讲解: app/ //开发目录; c/ //开发编译完成css文件夹; i/ //开发img文件夹; j/ / ...
- Grunt经常使用插件及演示样例说明
下述给出了经常使用Grunt插件,并列举了部分插件演示样例: 插件名称 说明 Github地址 grunt-contrib-clean 清空文件和目录 https://github.com/grunt ...
- grunt学习二
1. 新建文件和文件目录 mkdir grunt-in-action cd grunt-in-action cd grunt-in-action mkdir grunt-empty cd grunt- ...
- grunt学习一
grunt是前端自动化工具之一.下面是是grunt的简单小示例: 在使用grunt,确保安装nodejs,如果不清楚,可以百度找相关教程,这个教程已经烂大街了. 1.打开cmd,以管理员的身份.(或者 ...
- 10 Things ASP.NET Developers Should Know About Web.config Inheritance and Overrides(转)
10 Things ASP.NET Developers Should Know About Web.config Inheritance and Overrides Wednesday, Janua ...
- yeomen/bower/grunt
yeomen: npm install yo angular-in-action project npm install -g generator-angular npm install -g gen ...
- grunt配置详情
这个grunt配置 是我的一个程序员朋友从网上无意间看到的,然后他亲测了下,恩,是可以的.不过我到目前还未测试过是否可以. 一.安装node, 首先确保电脑已有node的环境.然后 运行 npm i ...
随机推荐
- 【UOJ #107】【APIO 2013】ROBOTS
http://uoj.ac/problem/107 设\(f(l,r,i,j)\)表示\([l,r]\)中的机器人聚集到\((i,j)\)需要花的最小操作数. \(f(l,r,i,j)=\min\le ...
- [BZOJ4416][SHOI2013]阶乘字符串(子集DP)
怎么也没想到是子集DP,想到了应该就没什么难度了. 首先n>21时必定为NO. g[i][j]表示位置i后的第一个字母j在哪个位置,n*21求出. f[S]表示S的所有全排列子序列出现的最后末尾 ...
- 【10.3校内测试【国庆七天乐!】】【DP+组合数学/容斥】【spfa多起点多终点+二进制分类】
最开始想的暴力DP是把天数作为一个维度所以怎么都没有办法优化,矩阵快速幂也是$O(n^3)$会爆炸. 但是没有想到另一个转移方程:定义$f[i][j]$表示每天都有值的$i$天,共消费出总值$j$的方 ...
- 区间DP POJ 1141 Brackets Sequence
Brackets Sequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 29520 Accepted: 840 ...
- php 导出excel
<?phpclass Excel { var $inEncode; var $outEncode; public function _construct() { } public functio ...
- Unity UGUI之Text
下图是Text组件的内容. Character(字符) Text--输入要显示的文本 Font--要渲染文本的字体类型(例如:黑体.宋体) FontStyle--是否要加粗,倾斜等. Normal-- ...
- 程序员应该知道的几个国外IT网站
程序员应该知道的几个国外IT网站 摘要:文中总结了几个常用的国外IT网站,下面列举出来供大家学习参考: 导读:文中总结了几个常用的国外IT网站,下面列举出来供大家学习参考: 1. TheServe ...
- ADC In An FPGA
http://davidkessner.wordpress.com/2011/05/01/adc-in-an-fpga/ Geek Alert! What follows is very techn ...
- STM32F10X FLASH and SRAM size
STM32F10X FLASH Size SRAM Size Device Type --------------------------------------------------------- ...
- Spring自动扫描组件
通常情况下,声明所有的Bean类或组件的XML bean配置文件,这样Spring容器可以检测并注册Bean类或组件. 其实,Spring是能够自动扫描,检测和预定义的项目包并实例化bean,不再有繁 ...