Browse Source

#1476, maintainer: watch now watches for changes in definition (regression in 0.13.0)

pull/1500/head
jlukic 10 years ago
parent
commit
ef2cfc4c3d
1 changed files with 7 additions and 4 deletions
  1. 11
      gulpfile.js

11
gulpfile.js

@ -194,6 +194,7 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb
stream, stream,
compressedStream, compressedStream,
uncompressedStream, uncompressedStream,
isDefinition,
isPackagedTheme, isPackagedTheme,
isSiteTheme, isSiteTheme,
isConfig isConfig
@ -204,25 +205,28 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb
; ;
// recompile on *.override , *.variable change // recompile on *.override , *.variable change
isDefinition = (file.path.indexOf(source.definitions) !== -1);
isPackagedTheme = (file.path.indexOf(source.themes) !== -1); isPackagedTheme = (file.path.indexOf(source.themes) !== -1);
isSiteTheme = (file.path.indexOf(source.site) !== -1); isSiteTheme = (file.path.indexOf(source.site) !== -1);
isConfig = (file.path.indexOf('.config') !== -1); isConfig = (file.path.indexOf('.config') !== -1);
if(isPackagedTheme || isSiteTheme) {
if(isDefinition || isPackagedTheme || isSiteTheme) {
srcPath = util.replaceExtension(file.path, '.less'); srcPath = util.replaceExtension(file.path, '.less');
srcPath = srcPath.replace(config.regExp.themePath, source.definitions); srcPath = srcPath.replace(config.regExp.themePath, source.definitions);
srcPath = srcPath.replace(source.site, source.definitions); srcPath = srcPath.replace(source.site, source.definitions);
} }
if(isConfig) {
else if(isConfig) {
console.log('Change detected in theme config'); console.log('Change detected in theme config');
gulp.start('build'); gulp.start('build');
} }
else {
srcPath = util.replaceExtension(file.path, '.less');
}
// get relative asset path (path returns wrong path? hardcoded) // get relative asset path (path returns wrong path? hardcoded)
// assetPaths.source = path.relative(srcPath, path.resolve(source.themes)); // assetPaths.source = path.relative(srcPath, path.resolve(source.themes));
assetPaths.source = '../../themes'; assetPaths.source = '../../themes';
if( fs.existsSync(srcPath) ) { if( fs.existsSync(srcPath) ) {
// unified css stream // unified css stream
@ -480,7 +484,6 @@ gulp.task('install', 'Set-up project for first time', function () {
.pipe(prompt.prompt(questions.setup, function(answers) { .pipe(prompt.prompt(questions.setup, function(answers) {
var var
siteVariable = /@siteFolder .*\'(.*)/mg, siteVariable = /@siteFolder .*\'(.*)/mg,
siteDestination = answers.site || config.folders.site, siteDestination = answers.site || config.folders.site,
pathToSite = path.relative(path.resolve(config.folders.theme), path.resolve(siteDestination)), pathToSite = path.relative(path.resolve(config.folders.theme), path.resolve(siteDestination)),

Loading…
Cancel
Save