Grunt-contrib-watch livereload option doesn't work

Grunt-contrib-watch livereload option doesn't work
0

#1

Hello,

I am quite new to Grunt. I tried to add Grunt-contrib-watch plugin to reload browser every time I make a change to my css.

Here is how Gruntfile.js looks like:


module.exports = function(grunt){
    grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.initConfig({
    watch: {
      files: ['*.*'],
      options: {
          livereload: true
      },
    },
  });
  grunt.registerTask('default',['watch']);
};

I can see that it works in the terminal (>> File “mystyle.css” changed.
Completed in 0.000s at Mon Dec 18 2017 17:37:35 GMT+0300 (EAT) - Waiting…). But it doesn’t refresh the browser. Do you know what can cause this issue?

Update: it seems like problem is in <script src="//localhost:35729/livereload.js"></script> that is not loading.
Thank you!


#2

The problem was solved when I changed the <script src="//localhost:35729/livereload.js"></script> to this version: <script src="http://localhost:35729/livereload.js"></script>. Now it’s actually running updates :slight_smile: