[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 ...
随机推荐
- Python对Excel的操作
Python几个读取Excel库的介绍: xlwings 可结合 VBA 实现对 Excel 编程,强大的数据输入分析能力,同时拥有丰富的接口,结合 pandas/numpy/matplotlib 轻 ...
- ORACLE里怎么能判断一个日期类型的字段是否为空,解决方法:is null
ORACLE里怎么能判断一个日期类型的字段是否为空,解决方法:is null,解决方法:判断什么null都可以用is null.
- 【51Nod 1238】最小公倍数之和 V3
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1238 设\(A(n)=\sum\limits_{i=1}^n\frac{ ...
- bzoj 1911: [Apio2010]特别行动队 -- 斜率优化
1911: [Apio2010]特别行动队 Time Limit: 4 Sec Memory Limit: 64 MB Description Input Output Sample Input 4 ...
- Codeforces Round #302 (Div. 1) C. Remembering Strings DP
C. Remembering Strings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
- 客户端获取ip
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Android中的数据存储(一):SharedPreferences 2017-05-24 10:35 64人阅读 评论(1) 收藏
SharedPreferences 这是本人(菜鸟)学习android数据存储时接触的有关SharedPreferences的知识以及本人自己写的一个简单地demo,为初学者学习和使用SharedPr ...
- linuxmint - setup - 搜狗输入法
安装好linuxmint18后,官网下载搜狗输入法安装包安装.安装成功后,发现缺失部分界面,包括输入候选框,软件设置,fcitx设置都不太正常. 解决: 安装:fcitx-ui-classic 另: ...
- 升/降压转换器 (Buck-boost)
升/降压转换器 (Buck-boost) 当输入电压是变动的,有时比输出电压高.有时却比较低时(例如放电中的电池),升/降压转换器 (Buck-boost) 是最佳的电源解决方案. 升/降压转换器 ( ...
- Tomcat配置域名和虚拟文件夹
说明: 我在本机中添加域名模拟,假设是主机直接配置也能够使用.我用的tomcat是apache-tomcat-7.0.42 本地添加域名 本文介绍怎样通过改动tomcat的配置.实现通过IP地址或者域 ...