Trying to fix gulpfile to avoid travis-ci errors

This commit is contained in:
Thomas A. Reinert 2018-03-04 14:51:27 +01:00
parent 4468772592
commit 9a704e71f1
1 changed files with 34 additions and 32 deletions

View File

@ -1,28 +1,28 @@
// Defining requirements // Defining requirements
var gulp = require('gulp'); var gulp = require( 'gulp' );
var plumber = require('gulp-plumber'); var plumber = require( 'gulp-plumber' );
var sass = require('gulp-sass'); var sass = require( 'gulp-sass' );
var watch = require('gulp-watch'); var watch = require( 'gulp-watch' );
var cssnano = require('gulp-cssnano'); var cssnano = require( 'gulp-cssnano' );
var rename = require('gulp-rename'); var rename = require( 'gulp-rename' );
var concat = require('gulp-concat'); var concat = require( 'gulp-concat' );
var uglify = require('gulp-uglify'); var uglify = require( 'gulp-uglify' );
var merge2 = require('merge2'); var merge2 = require( 'merge2' );
var imagemin = require('gulp-imagemin'); var imagemin = require( 'gulp-imagemin' );
var ignore = require('gulp-ignore'); var ignore = require( 'gulp-ignore' );
var rimraf = require('gulp-rimraf'); var rimraf = require( 'gulp-rimraf' );
var clone = require('gulp-clone'); var clone = require( 'gulp-clone' );
var merge = require('gulp-merge'); var merge = require( 'gulp-merge' );
var sourcemaps = require('gulp-sourcemaps'); var sourcemaps = require( 'gulp-sourcemaps' );
var browserSync = require('browser-sync').create(); var browserSync = require( 'browser-sync' ).create();
var del = require('del'); var del = require( 'del' );
var cleanCSS = require('gulp-clean-css'); var cleanCSS = require( 'gulp-clean-css' );
var gulpSequence = require('gulp-sequence'); var gulpSequence = require( 'gulp-sequence' );
var replace = require('gulp-replace'); var replace = require( 'gulp-replace' );
var autoprefixer = require('gulp-autoprefixer') var autoprefixer = require( 'gulp-autoprefixer' );
// Configuration file to keep your code DRY // Configuration file to keep your code DRY
var cfg = require('./gulpconfig.json'); var cfg = require( './gulpconfig.json' );
var paths = cfg.paths; var paths = cfg.paths;
// Run: // Run:
@ -42,7 +42,7 @@ gulp.task('scss-for-prod', function() {
var pipe1 = source.pipe(clone()) var pipe1 = source.pipe(clone())
.pipe(sourcemaps.write(undefined, { sourceRoot: null })) .pipe(sourcemaps.write(undefined, { sourceRoot: null }))
.pipe(gulp.dest(paths.css)) .pipe(gulp.dest(paths.css))
.pipe(rename('custom-editor-style.css')) .pipe(rename('custom-editor-style.css'));
var pipe2 = source.pipe(clone()) var pipe2 = source.pipe(clone())
@ -68,7 +68,7 @@ gulp.task('scss-for-dev', function() {
.pipe(sourcemaps.init({loadMaps: true})) .pipe(sourcemaps.init({loadMaps: true}))
.pipe(sass()) .pipe(sass())
.pipe(sourcemaps.write(undefined, { sourceRoot: null })) .pipe(sourcemaps.write(undefined, { sourceRoot: null }))
.pipe(gulp.dest(paths.css)) .pipe(gulp.dest(paths.css));
}); });
gulp.task('watch-scss', ['browser-sync'], function () { gulp.task('watch-scss', ['browser-sync'], function () {
@ -90,7 +90,7 @@ gulp.task('sass', function () {
.pipe(sass()) .pipe(sass())
.pipe(autoprefixer('last 2 versions')) .pipe(autoprefixer('last 2 versions'))
.pipe(gulp.dest(paths.css)) .pipe(gulp.dest(paths.css))
.pipe(rename('custom-editor-style.css')) .pipe(rename('custom-editor-style.css'));
return stream; return stream;
}); });
@ -121,7 +121,7 @@ gulp.task('imagemin-watch', ['imagemin'], function(done) {
gulp.task('imagemin', function(){ gulp.task('imagemin', function(){
gulp.src(paths.imgsrc + '/**') gulp.src(paths.imgsrc + '/**')
.pipe(imagemin()) .pipe(imagemin())
.pipe(gulp.dest(paths.img)) .pipe(gulp.dest(paths.img));
}); });
@ -140,7 +140,7 @@ gulp.task('cssnano', function(){
.pipe(rename({suffix: '.min'})) .pipe(rename({suffix: '.min'}))
.pipe(cssnano({discardComments: {removeAll: true}})) .pipe(cssnano({discardComments: {removeAll: true}}))
.pipe(sourcemaps.write('./')) .pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.css)) .pipe(gulp.dest(paths.css));
}); });
gulp.task('minify-css', function() { gulp.task('minify-css', function() {
@ -164,7 +164,9 @@ gulp.task('cleancss', function() {
.pipe(rimraf()); .pipe(rimraf());
}); });
gulp.task('styles', function(callback){ gulpSequence('sass', 'minify-css')(callback) }); gulp.task('styles', function(callback){
gulpSequence('sass', 'minify-css')(callback);
});
// Run: // Run:
@ -206,7 +208,7 @@ gulp.task('scripts', function() {
// Deleting any file inside the /src folder // Deleting any file inside the /src folder
gulp.task('clean-source', function () { gulp.task('clean-source', function () {
return del(['src/**/*',]); return del(['src/**/*']);
}); });
// Run: // Run:
@ -276,7 +278,7 @@ gulp.task('dist', ['clean-dist'], function() {
// Deleting any file inside the /dist folder // Deleting any file inside the /dist folder
gulp.task('clean-dist', function () { gulp.task('clean-dist', function () {
return del([paths.dist + '/**',]); return del([paths.dist + '/**']);
}); });
// Run // Run
@ -284,10 +286,10 @@ gulp.task('clean-dist', function () {
// Copies the files to the /dist-prod folder for distribution as theme with all assets // Copies the files to the /dist-prod folder for distribution as theme with all assets
gulp.task('dist-product', ['clean-dist-product'], function() { gulp.task('dist-product', ['clean-dist-product'], function() {
return gulp.src(['**/*', '!'+paths.bower, '!'+paths.bower+'/**', '!'+paths.node, '!'+paths.node+'/**', '!'+paths.dist, '!'+paths.dist+'/**', '!'+paths.distprod, '!'+paths.distprod+'/**', '*']) return gulp.src(['**/*', '!'+paths.bower, '!'+paths.bower+'/**', '!'+paths.node, '!'+paths.node+'/**', '!'+paths.dist, '!'+paths.dist+'/**', '!'+paths.distprod, '!'+paths.distprod+'/**', '*'])
.pipe(gulp.dest(paths.distprod)) .pipe(gulp.dest(paths.distprod));
}); });
// Deleting any file inside the /dist-product folder // Deleting any file inside the /dist-product folder
gulp.task('clean-dist-product', function () { gulp.task('clean-dist-product', function () {
return del([paths.distprod + '/**',]); return del([paths.distprod + '/**']);
}); });