From 5f9d3606f68df78506e7ef73b97605b808f6f5b3 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 5 Jun 2020 14:14:49 +0200 Subject: [PATCH] :bug: Restore css hot-reloading. --- frontend/gulpfile.js | 14 +++++++++++++- frontend/shadow-cljs.edn | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/gulpfile.js b/frontend/gulpfile.js index bc8bf37d4..9b09067ae 100644 --- a/frontend/gulpfile.js +++ b/frontend/gulpfile.js @@ -44,6 +44,14 @@ function scssPipeline(options) { }); }; + const touch = (_path) => { + return new Promise((resolve, reject) => { + return fs.utimes(file.path, new Date(), new Date(), () => { + resolve(_path); + }); + }) + }; + const render = (input) => { return new Promise((resolve, reject) => { sass.render({file: input}, async function(err, result) { @@ -69,7 +77,11 @@ function scssPipeline(options) { return mkdirp(path.dirname(output)) .then(() => render(input)) .then((res) => postprocess(res, input, output)) - .then((res) => write(output, res)) + .then(async (res) => { + await write(output, res); + await touch(output); + return res; + }) .catch((err) => null) .then(() => { next(); diff --git a/frontend/shadow-cljs.edn b/frontend/shadow-cljs.edn index 0f3c92143..6da3a14bf 100644 --- a/frontend/shadow-cljs.edn +++ b/frontend/shadow-cljs.edn @@ -7,7 +7,8 @@ {:target :browser :output-dir "resources/public/js/" :asset-path "/js" - :devtools {:browser-inject :main} + :devtools {:browser-inject :main + :watch-dir "resources/public"} :build-options {:manifest-name "manifest.json"} :modules