Browse Source

Fixes issue in #1344, gulp watch causes error when adjusting theme.config

pull/1481/head
jlukic 10 years ago
parent
commit
e2adad8147
1 changed files with 19 additions and 6 deletions
  1. 25
      gulpfile.js

25
gulpfile.js

@ -188,22 +188,35 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb
source.definitions + '**/*.less',
source.site + '**/*.{overrides,variables}',
source.themes + '**/*.{overrides,variables}'
], function(file) {
], function(file, event) {
var
srcPath,
stream,
compressedStream,
uncompressedStream
uncompressedStream,
isPackagedTheme,
isSiteTheme,
isConfig
;
gulp.src(file.path)
.pipe(print(log.modified))
;
// recompile only definition file
srcPath = util.replaceExtension(file.path, '.less');
srcPath = srcPath.replace(config.regExp.themePath, source.definitions);
srcPath = srcPath.replace(source.site, source.definitions);
// recompile on *.override , *.variable change
isPackagedTheme = (file.path.indexOf(source.themes) !== -1);
isSiteTheme = (file.path.indexOf(source.site) !== -1);
isConfig = (file.path.indexOf('.config') !== -1);
if(isPackagedTheme || isSiteTheme) {
srcPath = util.replaceExtension(file.path, '.less');
srcPath = srcPath.replace(config.regExp.themePath, source.definitions);
srcPath = srcPath.replace(source.site, source.definitions);
}
if(isConfig) {
console.log('Change detected in theme config');
gulp.start('build');
}
// get relative asset path (path returns wrong path? hardcoded)
// assetPaths.source = path.relative(srcPath, path.resolve(source.themes));

Loading…
Cancel
Save