Last active
August 29, 2015 14:14
-
-
Save kunkun12/31fb79a11e4cfd521b8e to your computer and use it in GitHub Desktop.
grunt-live-reload config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt){ | |
require('load-grunt-tasks')(grunt); //加载所有的任务 | |
grunt.initConfig({ | |
connect: { | |
options: { | |
port: 80, | |
hostname: 'localhost', //默认就是这个值,可配置为本机某个 IP,localhost 或域名 | |
livereload: 35729 //声明给 watch 监听的端口 | |
}, | |
server: { | |
options: { | |
open: true, //自动打开网页 http:// | |
base: [ | |
'../work' //主目录 | |
] | |
} | |
} | |
}, | |
watch: { | |
livereload: { | |
options: { | |
livereload: '<%=connect.options.livereload%>' //监听前面声明的端口 35729 | |
}, | |
files: []//下面文件的改变就会实时刷新网页 | |
} | |
} | |
}); | |
grunt.registerTask('serve', [ | |
'connect:server', | |
'watch' | |
]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test_connect", | |
"version": "0.0.1", | |
"devDependencies": { | |
"grunt-contrib-connect": "*", | |
"grunt-contrib-watch": "*", | |
"load-grunt-tasks": "*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment