node.js - gulp Copy from multiple locations, dont preserve structure -
im trying copy files multiple locations, 1 central location using gulp. dont want preserve directory path strucure being copied except directories within 1 im copying (hopefully makes sense).
so in example want preserve structure found in images directory.
i have:
var files = [ 'path/to/wp/my-mu-plugins/**/build/theme/images/**/*', 'path/to/wptheme/build/theme/images/**/*', 'bower_components/jquery-ui/themes/base/images/**/*', 'bower_components/jquery-ui/themes/ui-lightness/images/**/*', ]; return gulp.src(files) .pipe(gulp.dest('public_html/assets/images/')); i have tried different combination's of altering basename, base, dir , using glob pull them in - end either either flat structure or entire structure im copying from.
what combination of wizardy need achieve - or not possible?
thanks =)
edit: think issue path/to/wp/my-mu-plugins/** paths, that's trouble starts...
when writing dest() location gulp strips away base path path of every file. if no explicit base path provided, gulp (actually vinyl-fs) assumes first glob base path.
in case means 'path/to/wp/my-mu-plugins/' assumed base path matching 'path/to/wp/my-mu-plugins/**/build/theme/images/**/*'.
while can specify explicit base path using base option src() isn't of use you, since base option doesn't support globbing , don't know or how many subdirectories match 'my-mu-plugins/**'.
however can use base option disable default behavior , strip , including /images/ folder path using gulp-rename:
gulp.task('default', function() { return gulp.src(files, { base:'./' }) .pipe(rename(function(path) { path.dirname = path.dirname.replace(/(.*)?\/images\/?/, ''); })) .pipe(gulp.dest('public_html/assets/images/')); });
Comments
Post a Comment