Skip to content

Commit e1dc1b9

Browse files
nb-ohadnimrod-becker
authored andcommitted
Add a workaround for less caching issue (new less version)
see less/less.js#3185
1 parent 5ee4a7d commit e1dc1b9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

frontend/gulpfile.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const runSequence = require('run-sequence');
1717
const through = require('through2');
1818
const moment = require('moment');
1919
const spawn = require('child_process').spawn;
20+
const less = require('less');
2021
const $ = require('gulp-load-plugins')();
2122

2223
const cwd = process.cwd();
@@ -328,7 +329,18 @@ gulp.task('watch-debug', ['lint-debug'], () => {
328329
});
329330

330331
gulp.task('watch-styles', ['compile-styles'], () => {
331-
return $.watch(['src/app/**/*.less'], () => {
332+
return $.watch(['src/app/**/*.less'], event => {
333+
// A workaround for https://github.com/stevelacy/gulp-less/issues/283#ref-issue-306992692
334+
// (with underlaying bug https://github.com/less/less.js/issues/3185)
335+
const fileManagers = less.environment && less.environment.fileManagers || [];
336+
fileManagers.forEach(function (fileManager) {
337+
const relativePath = path.relative(process.cwd(), event.path);
338+
if (fileManager.contents && fileManager.contents[relativePath]) {
339+
// clear the changed file cache;
340+
fileManager.contents[relativePath] = null;
341+
}
342+
});
343+
332344
runSequence('compile-styles');
333345
});
334346
});

0 commit comments

Comments
 (0)