首页 > 其他 > 详细

grunt-watch

时间:2015-10-31 22:52:14      阅读:318      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!