javascript - browser livereload not working when using grunt-contrib-watch with combination of grunt-express -
i started test livereload ability of combination of grunt watch plugin (grunbt-contrib-watch) , grunt express server (grunt-express). directory has gruntfile.js file in root directory, npm modules installed in npm_modules folder , there folder called "build" contains 1 html file. 3 packages installed using npm :
- grunt
- grunt-contrib-watch
- grunt-express
they working fine. watch plugin watching html file , server running @ localhost:3000, problem livereload property of express plugin not working when change html file. can't figure out why?
my guntfile.js looks bellow:
module.exports = function(grunt) { grunt.initconfig({ watch: { html: { files: ['build/*.html'], tasks: [] } }, express: { all: { options: { bases: 'build', livereload: true, open: 'http://localhost:3000' } } } }); grunt.loadnpmtasks('grunt-contrib-watch'); grunt.loadnpmtasks('grunt-express'); grunt.registertask('start', ['express','watch']); };
on watch config add:
options: { nospawn: true, atbegin: true, } ref link: http://thanpol.as/grunt/grunt-with-express-server-and-livereload/
Comments
Post a Comment