Sto provando a configurare grunt su file livereload js e less/css sulle modifiche. Mentre grunt "guarda" correttamente ed esegue compiti assegnati, non carica i file. Di seguito è la mia configurazione, qualcuno può vedere cosa c'è che non va?Grunt Live-Reload via Watch
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
jshint: {
files: ["Gruntfile.js", "src/javascripts/**/*.js"],
options: {
globals: {
jQuery: true,
console: true,
module: true
}
}
},
concat: {
options: {
stripBanners: true,
banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> */\n",
separator: "\n"
},
js: {
src: ["src/javascripts/main.js", "src/javascripts/**/*.js"],
dest: "../app/assets/javascripts/application.js"
},
less: {
src: ["src/stylesheets/**/*.less"],
dest: "../app/assets/stylesheets/application.less"
}
},
watch: {
js: {
files: ["<%= jshint.files %>"],
tasks: ["jshint", "concat:js"],
options: {
livereload: true
}
},
less: {
files: ["<%= concat.less.src %>"],
tasks: ["concat:less"],
options: {
livereload: true
}
}
}
});
grunt.loadNpmTasks("grunt-contrib");
grunt.registerTask("default", ["jshint", "concat"]);
};
Nota: ho incluso il seguente tag script all'interno del tag head html.
<script src="http://localhost:35729/livereload.js"></script>
ho riconfigurato orologio come lei ha suggerito sopra, ma purtroppo, live-reload ancora non eseguiti. – Ari
Si può fare 'grunt watch --verbose' e ti dirà quando si ricaricherà nella console. Anche se ho notato che stai usando 'grunt.loadNpmTasks ('grunt-contrib')' ... che usa una versione precedente dell'attività di watch che non ha una ricarica live. Raccomando * non * usando 'grunt-contrib' e caricando ogni modulo individualmente. –
Il caricamento di ciascun modulo ha risolto il problema singolarmente. Grazie. – Ari