-->

sails.js less livereload with grunt watch not work

2019-07-25 06:02发布

问题:

I got my less files compiled in css perfectly by grunt and I see result in .tmp/public/styles
So now livereload with grunt-contrib-watch should be made naturally in sails generated project ?
Or do I have to make a special configuration ?

I found that in tasks/pipeline.js file but not sure of what to do.

// CSS files to inject in order
//
// (if you're using LESS with the built-in default config, you'll want
//  to change `assets/styles/importer.less` instead.)
var cssFilesToInject = [
  'styles/**/*.css'
];

I saw in the file tasks/README.md :

###### `sails lift`

Runs the `default` task (`tasks/register/default.js`).

And in the file default.js we got :

module.exports = function (grunt) {
    grunt.registerTask('default', ['compileAssets', 'linkAssets',  'watch']);
};

But watch.js file is missing in the folder...
What should it be ?

回答1:

Watch does only looking for files that have changed and execute less, sass, injection and so on - but it doesn't make a reload.

You can add this in task/config/watch.js