[Grunt] grunt.initConfig() && grunt.file
amp File grunt
2023-09-14 09:00:56 时间
/** * Created by Answer1215 on 9/1/2014. */ module.exports = function(grunt){ grunt.initConfig({ person: { "firstName": "Zhentian" } }) grunt.registerTask("default",function(name){ grunt.log.writeln("Hello Grunt World, welcome: "+grunt.config.get("person").firstName); }) }
Type in the Terminal:
grunt
We will get the reuslts:
C:\Users\Answer1215\WebstormProjects\angular\Grunt_Demo>grunt Running "default" task Hello Grunt World, welcome: Zhentian Done, without errors.
Also we can use json file to do that:
Create a json file. config.json:
{ "person":{ "firstName": "Zhentian Wan" } }
We change the code in GruntFile.js:
module.exports = function(grunt){ /* grunt.initConfig({ person: { "firstName": "Zhentian" } })*/
grunt.file.defaultEncoding = 'utf8'; grunt.initConfig(grunt.file.readJSON('config.json')); grunt.registerTask("default",function(name){ grunt.log.writeln("Hello Grunt World, welcome: "+grunt.config.get("person").firstName); }) }
type in triminail:
grunt
We will get the result:
C:\Users\Answer1215\WebstormProjects\angular\Grunt_Demo>grunt Running "default" task Hello Grunt World, welcome: Zhentian Wan Done, without errors.
Read More about grunt.file: http://gruntjs.com/api/grunt.file
相关文章
- hive时间戳转换&UDF更新
- RMAN备份失败: ORA-19502 & ORA-27072: File I/O error
- EXP&EXPDP导出数据同步问题
- [AST Eslint] No console with schema options && isPrimitive
- [Grunt] grunt.initConfig() && grunt.file
- Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
- Unable to read the project file 'client.csproj'. Could not load file or assembly 'Microsoft.Build.En
- AI公开课:03月26日未来十年 AI如何进化—圆桌探讨(乌镇智库理事长、CSDN 创始人&董事长、智源人工智能研究院副院长)之《AI:昨天 · 今天 · 明天》
- Paper之CV之FR&FA:《One Millisecond Face Alignment with an Ensemble of Regression Trees》的翻译与解读
- 成功解决fp = builtins.open(filename, "rb") OSError: [Errno 22] Invalid argument: 'F:File_Pyt
- 成功解决OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in cv::resize, file C:proj
- Java int转byte数组&Integer.toHexString
- 【大数据 & AI 人工智能】源动力:改变未来世界的5大核心力量
- Shell重定向&>file、2>&1、1>&2的区别
- Could not load file or assembly'System.Data.SQLite.dll' or one of its depedencies
- Android 儿子Activity在启动过程中的流程组件 && 儿子Activity在一个新的进程组件启动过程
- unix & linux oralce用户 内存使用情况分析
- Data Types in the Kernel <LDD3 学习笔记>