i trying add livereload of broser when changing files, browser not reloading, , cant why, described here, , browser opens when tun grunt, when change index.html
, in console getting
waiting... >> file "index.html" changed. completed in 0.000s @ wed jun 03 2015 11:45:24 gmt+0300 (eest) - waiting... >> file "index.html" changed. completed in 0.000s @ wed jun 03 2015 11:54:11 gmt+0300 (eest) - waiting... >> file "index.html" changed. completed in 0.000s @ wed jun 03 2015 12:01:30 gmt+0300 (eest) - waiting...
but browser not reloading, doing wrong? maybe miss something? trying googling problem didnt helpful results... if need gruntfile or any, me. thanks!
here gruntfile.js :
module.exports = function(grunt) { // load grunt tasks declared in package.json file require('matchdep').filterdev('grunt-*').foreach(grunt.loadnpmtasks); // configure grunt grunt.initconfig({ // grunt express - our webserver // https://github.com/blai/grunt-express express: { all: { options: { bases: ['var\\www\\megapolis'], port: 8080, hostname: "localhost", livereload: true } } }, // grunt-watch monitor projects files // https://github.com/gruntjs/grunt-contrib-watch watch: { all: { files: '**/*.html', options: { livereload: true } } }, // grunt-open open browser @ project's url // https://www.npmjs.org/package/grunt-open open: { all: { path: 'http://localhost/megapolis/index.html' } } }); // creates `server` task grunt.registertask('server', [ 'express', 'open', 'watch' ]); };
maybe cause grunt-open plugin not configured same port express server. grunt-open plugin using default 80 port while express configured on 8080.
try appending same 8080 port in express configuration:
// grunt-open open browser @ project's url // https://www.npmjs.org/package/grunt-open open: { all: { path: 'http://localhost:8080/megapolis/index.html' } }
Comments
Post a Comment