使用Grunt增加 live reload
来源:互联网 发布:php微信订餐系统源码 编辑:程序博客网 时间:2024/06/04 19:07
新建 package.json
{
"name": "test_connect","version": "0.0.1",
"devDependencies": {
"grunt-contrib-connect": "~0.6.0",
"grunt-contrib-watch": "~0.5.3",
"load-grunt-tasks": "~0.3.0"
}
}
新建 Gruntfile.js
module.exports = function(grunt){
require('load-grunt-tasks')(grunt); //加载所有的任务
//require('time-grunt')(grunt); 如果要使用 time-grunt 插件
grunt.initConfig({
connect: {
options: {
port: 9000,
hostname: 'localhost', //默认就是这个值,可配置为本机某个 IP,localhost 或域名
livereload: 35729 //声明给 watch 监听的端口
},
server: {
options: {
open: true, //自动打开网页 http://
base: [
'manager' //主目录
]
}
}
},
watch: {
livereload: {
options: {
livereload: '<%=connect.options.livereload%>' //监听前面声明的端口 35729
},
files: [ //下面文件的改变就会实时刷新网页
'manager/*.html',
'manager/style/{,*/}*.css',
'manager/scripts/{,*/}*.js',
'manager/images/{,*/}*.{png,jpg}'
]
}
}
});
grunt.registerTask('serve', [
'connect:server',
'watch'
]);
}
使用npm install 下载 grunt运行环境
使用grunt serve运行
- 使用Grunt增加 live reload
- grunt live reload 配置记录
- Grunt-Grunt使用
- grunt使用
- grunt使用
- grunt使用
- grunt 使用
- python3使用reload函数
- grunt的grunt-contrib-jshint插件使用
- grunt的grunt-contrib-concat插件使用
- 使用Grunt构建项目
- Grunt使用示例
- grunt安装使用
- grunt使用 CLI
- 安装及使用grunt
- Grunt使用记录
- grunt使用笔记
- grunt使用小结
- Trick:不用table,怎么等分DIV
- Remove Duplicates from Sorted Array II
- Proving Equivalences UVALive 4287 图的强连通分量
- 黑马程序员——ios学习笔记 OC 初步认识
- hdoj 1242 Rescue [BFS]
- 使用Grunt增加 live reload
- Android shape drawable
- Boot Camp根据mac机型选择
- java中的并发:线程的基本使用
- 欢迎使用CSDN-markdown编辑器
- mysql协议学习(三)--OK报文
- 1181 变形课【dfs】
- ubuntu10.04 eclipse C/C++平台搭建
- 最近犯的错误