Answer the question
In order to leave comments, you need to log in
How to reload json config when restarting a task in Gulp?
The ./res/lvl_1.json file contains some configuration that needs to be processed, and the result of processing is sent as a local variable to the jade template. Configured to restart the jade task when changing in the config.
The problem is that restarting the task and recompiling the jade template is successful, but the changes made to the configuration file are not picked up.
For example, in the ./res/lvl_1.json file there is a width field, when I change it, the task is restarted and the page is reloaded, but there were no changes on the page. And when you restart gulp, all the changes are there.
gulp.task 'jade', ->
lvl = require './res/lvl_1.json'
console.log lvl.width # выводит одно и то же число, хотя я его изменяю
gulp.src 'jade/index.jade'
.pipe jade
pretty: true
locals:
game_file: game_file
barrier: make_barrier(lvl.barrier)
width: lvl.width
height: lvl.height
.pipe gulp.dest 'dist'
.pipe livereload()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question