0

I have a grunt-watch task that triggers livereload, when it detects changes to files. However it does not trigger a page reload when I change .less files. On that occasion it only makes the page reload the app.less which updates the styling. This seems to be intended, but for my project it would be more practical to also have a full page reload on that occasion. Can I force grunt-watch to always perform a full page reload? BR, Daniel

Daniel
  • 597
  • 11
  • 19
  • use `files: ['less/**/*.less']` – Bass Jobsen Nov 10 '14 at 22:00
  • This is what I do and the watch task is triggered alright, but instead of a full page reload it only triggers less injected into the website to recompile. That's not what I want. – Daniel Nov 11 '14 at 08:23

1 Answers1

0

You can use grunt-touch to trigger a change on your html file:

module.exports = function(grunt) {
grunt.initConfig({
   less: {
                 development: {
                     files: {"index.css": "test.less"}
                 }
  },
  touch: {
    options: {
      force: true,
      mtime: true
    },
    src: ['index.html'],
  },
  watch: {
    less: {
      files: ['*.less'],
      tasks: ["less","touch"],
    },
    livereload: {
      options: { livereload: true },
      files: ['index.html'],
    },
  },
}
);
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-touch');
grunt.registerTask( 'default', ["less","watch"] );
};
Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224