Grunt
来源:互联网 发布:sketch mac汉化破解版 编辑:程序博客网 时间:2024/04/30 13:59
安装grunt 首先是要安装 node 。
通过node的官网可以下载下来,同时还有node 的 npm 也会一起下载下来的,不需要另外重复下载。
然后打开node 的 npm
npm install -g grunt-cli
这样在全局范围下载了grunt
然后再建立新项目文件夹,比如 test ,通过指令 cd test 进入文件夹后
输入指令
npm init
输入指令 将会出来一个 package.json 文件
npm install grunt --save-dev
将会发现有一个文件夹出来
这里是所有的grunt插件
Gruntfile.js文件是自己创建的。用来写各种任务(文件压缩 合并等)。
grunt.initConfig({ concat: { // 这里是concat任务的配置信息。 }, uglify: { // 这里是uglify任务的配置信息 }, watch:{ // 这里是watch任务的配置信息 } // 任意数据。 my_property: 'whatever', my_src_files: ['foo/*.js', 'bar/*.js'],});
jshint:{ //“build”中描述了jshint要检查哪些js文档的语法。 build:['Gruntfile.js', 'src/**/*.js'], options:{ //“options”中描述了要通过怎么的规则检查语法 globals: { jQuery: true, console: true, module: true, document: true } } }
foo/*.js
会匹配 foo/ 目录下以 .js 结尾的任何文件(但是不包括子目录),而 foo/**/*.js
会匹配foo以及其子目录下的任何以 .js 结尾的文件。
网址链接
http://xiaomiya.iteye.com/blog/2177877
http://www.jikexueyuan.com/course/860_3.html?ss=1
http://developer.51cto.com/art/201506/479127.htm
http://www.cnblogs.com/yexiaochai/p/3603389.html
http://www.oschina.net/code/snippet_2289011_52994
在查找的时候找到一些关于Node 的文章
http://www.nodebeginner.org/index-zh-cn.html#javascript-and-nodejs
还是需要亲手操作实验一下,看看是否有用。在重构个人网站的时候i,我开始使用grunt 。需要进行js css img的相关操作。
总而言之,最后的文件在这里
http://www.webmxx.com/Blog/Gruntfile.js
使用了文件压缩,事件监听
'uglify', 'cssmin','imagemin','watch'
对于grunt 的进一步用法,点击这里查看相关资料
- grunt
- grunt
- Grunt
- Grunt
- grunt
- grunt
- Grunt
- grunt
- Grunt
- grunt
- Grunt
- grunt
- grunt教程--初涉grunt
- grunt教程-安装grunt
- Grunt-Grunt使用
- 【Grunt】Grunt打包入门
- 【Grunt】Grunt打包流程
- grunt js
- 解决mac OS X 下出现的 java.net.UnknownHostException 异常
- Web之页面关联关系之forward&redirect笔记
- pat1003:我要通过!
- 解决 PHP Interpreter is not configured Please configure PHP Interpreter to use built-in web server
- mac下更新pip时提示OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.0.2-py2.
- Grunt
- 基础6
- c++编译器对多态的实现原理总结
- HUST 1599 (找规律)
- git学习
- Linux 如何查看进程的各线程的CPU占用
- 公共技术点之 Java 反射 Reflection
- 深入FFM原理与实践
- HDOJ-1754 I Hate It