码迷,mamicode.com
首页 > 其他好文 > 详细

grunt-watch

时间:2015-10-31 22:53:27      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:

module.exports = function (grunt){
	// laod all grunt tasks automatically
	require(‘load-grunt-tasks‘)(grunt);

	// time how long grunt task take, can help when optimizing build times
	require(‘time-grunt‘)(grunt);

	// configure grunt

	grunt.initConfig({
		// the actual grunt server settings
		connect: {
			options: {
				port: 9000,
				hostname: ‘localhost‘,
				//keepalive: true
				livereload: 35729
			},
			all: {
				options: {
					open: true,
					base: [‘./‘] // index.html directory
				}
			}
		},
		// watch files for changes, and run tasks base on the changed files
		watch: {
			livereload: {
				options: {
					// this port must be same with the connect livereload port
					livereload: ‘<%= connect.options.livereload %>‘
				},
				// watch whatever files you needed.
				files: [
					‘./*.html‘,
					‘./app/styles/*.css‘,
					‘./app/js/(,*/)*.js‘,
					‘./app/images/(,*/)*.{png,jpg,gif}‘/
				]
			}
		}
	});

	// creates the server task
	grunt.registerTask(‘serve‘, [‘connect:all‘, ‘watch‘]);
}

  

grunt-watch

标签:

原文地址:http://www.cnblogs.com/walle2/p/4926377.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!