How to use grunt-contrib-livereload?

后端 未结 4 1604
一个人的身影
一个人的身影 2020-12-04 07:59

I\'m trying to use grunt-contrib-livereload, but can\'t seem to figure it out. The readme seems to skip over everything that I need explained, and then ends with an example

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 08:18

    Live reloading is now built into grunt-contrib-watch version 0.4.0. grunt-contrib-livereload and grunt-regarde will be deprecated soon.

    Now just set the option livereload to true in your config and it will create a live reload server then reload after the tasks have run:

    grunt.initConfig({
      watch: {
        all: {
          options: { livereload: true },
          files: ['lib/*.js'],
          tasks: ['jshint'],
        },
      },
    });
    

    By default the live reload server will be started on port 35729. So to enable live reloading on your page just add to your page.

    View more info on the docs: https://github.com/gruntjs/grunt-contrib-watch#live-reloading

提交回复
热议问题