Added vendor subfolder option with default intact

paths.vendor defaults to "" keeping the current structure while allowing
for a vendor subfolder. Added gulp-replace to allow existing files
(just enqueue.php now) to be updated on gulp dist
This commit is contained in:
Sam 2018-01-25 16:09:03 -06:00
parent 4d54df2c63
commit f710222051
3 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,7 @@
"bower": "./bower_components/",
"dev": "./src",
"dist": "./dist",
"distprod": "./dist-product"
"distprod": "./dist-product",
"vendor": ""
}
}

View File

@ -18,6 +18,7 @@ var browserSync = require('browser-sync').create();
var del = require('del');
var cleanCSS = require('gulp-clean-css');
var gulpSequence = require('gulp-sequence');
var replace = require('gulp-replace');
// Configuration file to keep your code DRY
var cfg = require('./gulpconfig.json');
@ -251,6 +252,9 @@ gulp.task('copy-assets', function() {
// Copies the files to the /dist folder for distribution as simple theme
gulp.task('dist', ['clean-dist'], function() {
return gulp.src(['**/*', '!'+paths.bower, '!'+paths.bower+'**', '!'+paths.node, '!'+paths.node+'**', '!'+paths.dev, '!'+paths.dev+'/**', '!'+paths.dist, '!'+paths.dist+'/**', '!'+paths.distprod, '!'+paths.distprod+'/**', '!'+paths.sass, '!'+paths.sass+'/**', '!readme.txt', '!readme.md', '!package.json', '!gulpfile.js', '!CHANGELOG.md', '!.travis.yml', '!jshintignore', '!codesniffer.ruleset.xml', '*'])
.pipe(replace('/js/jquery.slim.min.js', '/js'+paths.vendor+'/jquery.slim.min.js'))
.pipe(replace('/js/popper.min.js', '/js'+paths.vendor+'/popper.min.js'))
.pipe(replace('/js/skip-link-focus-fix.js', '/js'+paths.vendor+'/skip-link-focus-fix.js'))
.pipe(gulp.dest(paths.dist));
});

View File

@ -41,6 +41,7 @@
"gulp-merge": "^0.1.1",
"gulp-plumber": "^1.2.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",
"gulp-rimraf": "^0.2.2",
"gulp-sass": "^3.1.0",
"gulp-sequence": "^0.4.6",