javascript - Warning: Unable to write "..." file (Error code: UNKNOWN). Livereload option -
i want use grunt-contrib-watch livereload option. if change in file before opened browser compiles right.
once opened browser no longer rewrites files. maybe problem because i'm using windows os?
run server> while (true) {changing code - compiles fine} > run browser
run server> run browser > changing code - unknown error.
running "fest:templates" (fest) task
compiling "templates/game.xml" "public_html/js/tmpl/game.js"...warning: unable write "public_html/js/tmpl/game.js" file (error code: unknown). use --force continue.
here gruntfile.js:
module.exports = function (grunt) { grunt.initconfig({ shell: { /*grunt-shell*/ options: { /*настройка задачи*/ stdout: true, stderr: true }, server: { command: 'java -jar 2dcontra-1.0-jar-with-dependencies.jar 8080' } }, fest: { /*grunt-fest*/ templates: { /*Подзадача*/ files: [{ /* указание файлов группами */ expand: true, cwd: 'templates', /* исходная директория */ src: '*.xml', /* имена шаблонов */ dest: 'public_html/js/tmpl' /* результирующая директория */ }], options: { /* формат функции шаблона */ template: function (data) { return grunt.template.process( /* присваиваем функцию шаблона */ 'var <%= name %>tmpl = <%= contents %> ;', {data: data} ); } } } }, watch: { /*grunt-watch*/ fest: {/*Подзадача*/ files: ['templates/*.xml'], /* Следим за шаблонами */ tasks: ['fest'], /* Перекомпилировать */ options: { interrupt: true, atbegin: true /* Запустить задачу при старте */ } }, server: {/*Подзадача*/ files: [ /* Следим за js */ 'public_html/js/**/*.js', 'public_html/css/**/*.css' ], options: { livereload: true /* автоматическая перезагрузка */ } } }, concurrent: { /*grunt-concurrent*/ target: ['watch', 'shell'], options: { logconcurrentoutput: true /* Вывод процесса */ } } }); grunt.loadnpmtasks('grunt-contrib-watch'); grunt.loadnpmtasks('grunt-concurrent'); grunt.loadnpmtasks('grunt-shell'); grunt.loadnpmtasks('grunt-fest'); grunt.registertask('default', ['concurrent']); };
save life. work , don't type "grunt" every time when changed code.
Comments
Post a Comment