Eliminate gulp-flatten

This commit is contained in:
Mark McDowall 2019-03-22 19:07:35 -07:00
parent 7ed2776476
commit 95bb73c5ac
4 changed files with 11 additions and 24 deletions

View File

@ -2,7 +2,6 @@ const path = require('path');
const gulp = require('gulp'); const gulp = require('gulp');
const print = require('gulp-print').default; const print = require('gulp-print').default;
const cache = require('gulp-cached'); const cache = require('gulp-cached');
const flatten = require('gulp-flatten');
const livereload = require('gulp-livereload'); const livereload = require('gulp-livereload');
const paths = require('./helpers/paths.js'); const paths = require('./helpers/paths.js');
@ -10,16 +9,15 @@ gulp.task('copyJs', () => {
return gulp.src( return gulp.src(
[ [
path.join(paths.src.root, 'polyfills.js') path.join(paths.src.root, 'polyfills.js')
]) ], { base: paths.src.root })
.pipe(cache('copyJs')) .pipe(cache('copyJs'))
.pipe(print()) .pipe(print())
.pipe(flatten())
.pipe(gulp.dest(paths.dest.root)) .pipe(gulp.dest(paths.dest.root))
.pipe(livereload()); .pipe(livereload());
}); });
gulp.task('copyHtml', () => { gulp.task('copyHtml', () => {
return gulp.src(paths.src.html) return gulp.src(paths.src.html, { base: paths.src.root })
.pipe(cache('copyHtml')) .pipe(cache('copyHtml'))
.pipe(print()) .pipe(print())
.pipe(gulp.dest(paths.dest.root)) .pipe(gulp.dest(paths.dest.root))
@ -28,22 +26,20 @@ gulp.task('copyHtml', () => {
gulp.task('copyFonts', () => { gulp.task('copyFonts', () => {
return gulp.src( return gulp.src(
path.join(paths.src.fonts, '**', '*.*') path.join(paths.src.fonts, '**', '*.*'), { base: paths.src.root }
) )
.pipe(cache('copyFonts')) .pipe(cache('copyFonts'))
.pipe(print()) .pipe(print())
.pipe(flatten({ subPath: 2 }))
.pipe(gulp.dest(paths.dest.root)) .pipe(gulp.dest(paths.dest.root))
.pipe(livereload()); .pipe(livereload());
}); });
gulp.task('copyImages', () => { gulp.task('copyImages', () => {
return gulp.src( return gulp.src(
path.join(paths.src.images, '**', '*.*') path.join(paths.src.images, '**', '*.*'), { base: paths.src.root }
) )
.pipe(cache('copyImages')) .pipe(cache('copyImages'))
.pipe(print()) .pipe(print())
.pipe(flatten({ subPath: 2 }))
.pipe(gulp.dest(paths.dest.root)) .pipe(gulp.dest(paths.dest.root))
.pipe(livereload()); .pipe(livereload());
}); });

View File

@ -1,15 +1,15 @@
const root = './frontend/src/'; const root = './frontend/src';
const paths = { const paths = {
src: { src: {
root, root,
html: `${root}*.html`, html: `${root}/*.html`,
scripts: `${root}**/*.js`, scripts: `${root}/**/*.js`,
content: `${root}Content/`, content: `${root}/Content/`,
fonts: `${root}Content/Fonts/`, fonts: `${root}/Content/Fonts/`,
images: `${root}Content/Images/`, images: `${root}/Content/Images/`,
exclude: { exclude: {
libs: `!${root}JsLibraries/**` libs: `!${root}/JsLibraries/**`
} }
}, },
dest: { dest: {

View File

@ -59,7 +59,6 @@
"gulp-cached": "1.1.1", "gulp-cached": "1.1.1",
"gulp-concat": "2.6.1", "gulp-concat": "2.6.1",
"gulp-declare": "0.3.0", "gulp-declare": "0.3.0",
"gulp-flatten": "0.4.0",
"gulp-livereload": "4.0.1", "gulp-livereload": "4.0.1",
"gulp-postcss": "8.0.0", "gulp-postcss": "8.0.0",
"gulp-print": "5.0.0", "gulp-print": "5.0.0",

View File

@ -3916,14 +3916,6 @@ gulp-declare@0.3.0:
vinyl-map "^1.0.1" vinyl-map "^1.0.1"
xtend "^4.0.0" xtend "^4.0.0"
gulp-flatten@0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/gulp-flatten/-/gulp-flatten-0.4.0.tgz#d9ac819416c30fd5dfb3dea9da79c83a1bcd61d1"
integrity sha512-eg4spVTAiv1xXmugyaCxWne1oPtNG0UHEtABx5W8ScLiqAYceyYm6GYA36x0Qh8KOIXmAZV97L2aYGnKREG3Sg==
dependencies:
plugin-error "^0.1.2"
through2 "^2.0.0"
gulp-livereload@4.0.1: gulp-livereload@4.0.1:
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/gulp-livereload/-/gulp-livereload-4.0.1.tgz#cb438e62f24363e26b44ddf36fd37c274b8b15ee" resolved "https://registry.yarnpkg.com/gulp-livereload/-/gulp-livereload-4.0.1.tgz#cb438e62f24363e26b44ddf36fd37c274b8b15ee"