Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #90 from pattern-lab/dev
Browse files Browse the repository at this point in the history
resolve path with proper concatenation of globs
  • Loading branch information
bmuenzenmeyer authored Nov 6, 2016
2 parents 3dbb57f + 75bcef6 commit 9fd4a08
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ gulp.task('pl-copy:font', function(){

// CSS Copy
gulp.task('pl-copy:css', function(){
return gulp.src(resolvePath(paths().source.css, '*.css'))
return gulp.src(resolvePath(paths().source.css) + '/*.css')
.pipe(gulp.dest(resolvePath(paths().public.css)))
.pipe(browserSync.stream());
});

// Styleguide Copy everything but css
gulp.task('pl-copy:styleguide', function(){
return gulp.src(resolvePath(paths().source.styleguide, '**/!(*.css)'))
return gulp.src(resolvePath(paths().source.styleguide) + '/**/!(*.css)')
.pipe(gulp.dest(resolvePath(paths().public.root)))
.pipe(browserSync.stream());
});

// Styleguide Copy and flatten css
gulp.task('pl-copy:styleguide-css', function(){
return gulp.src(resolvePath(paths().source.styleguide, '**/*.css'))
return gulp.src(resolvePath(paths().source.styleguide) + '/**/*.css')
.pipe(gulp.dest(function(file){
//flatten anything inside the styleguide into a single output dir per http://stackoverflow.com/a/34317320/1790362
file.path = path.join(file.base, path.basename(file.path));
return resolvePath(path.join(paths().public.styleguide, 'css'));
return resolvePath(path.join(paths().public.styleguide, '/css'));
}))
.pipe(browserSync.stream());
});
Expand Down Expand Up @@ -141,7 +141,7 @@ function getSupportedTemplateExtensions() {
}
function getTemplateWatches() {
return getSupportedTemplateExtensions().map(function (dotExtension) {
return resolvePath(paths().source.patterns, '**/*' + dotExtension);
return resolvePath(paths().source.patterns) + '/**/*' + dotExtension;
});
}

Expand All @@ -154,19 +154,21 @@ function reloadCSS() {
}

function watch() {
gulp.watch(resolvePath(paths().source.css, '**/*.css'), { awaitWriteFinish: true }).on('change', gulp.series('pl-copy:css', reloadCSS));
gulp.watch(resolvePath(paths().source.styleguide, '**/*.*'), { awaitWriteFinish: true }).on('change', gulp.series('pl-copy:styleguide', 'pl-copy:styleguide-css', reloadCSS));
gulp.watch(resolvePath(paths().source.css) + '/**/*.css', { awaitWriteFinish: true }).on('change', gulp.series('pl-copy:css', reloadCSS));
gulp.watch(resolvePath(paths().source.styleguide) + '/**/*.*', { awaitWriteFinish: true }).on('change', gulp.series('pl-copy:styleguide', 'pl-copy:styleguide-css', reloadCSS));

var patternWatches = [
resolvePath(paths().source.patterns, '**/*.json'),
resolvePath(paths().source.patterns, '**/*.md'),
resolvePath(paths().source.data, '*.json'),
resolvePath(paths().source.fonts + '/*'),
resolvePath(paths().source.images + '/*'),
resolvePath(paths().source.meta, '*'),
resolvePath(paths().source.annotations + '/*')
resolvePath(paths().source.patterns) + '/**/*.json',
resolvePath(paths().source.patterns) + '/**/*.md',
resolvePath(paths().source.data) + '/*.json',
resolvePath(paths().source.fonts) + '/*',
resolvePath(paths().source.images) + '/*',
resolvePath(paths().source.meta) + '/*',
resolvePath(paths().source.annotations) + '/*'
].concat(getTemplateWatches());

console.log(patternWatches);

gulp.watch(patternWatches, { awaitWriteFinish: true }).on('change', gulp.series(build, reload));
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "edition-node-gulp",
"description": "The gulp wrapper around patternlab-node core, providing tasks to interact with the core library and move supporting frontend assets.",
"version": "1.3.3",
"version": "1.3.4",
"dependencies": {
"browser-sync": "^2.0.0",
"gulp": "gulpjs/gulp#4.0",
Expand Down

0 comments on commit 9fd4a08

Please sign in to comment.