and more empty spaces for Travis

This commit is contained in:
Holger Könemann 2018-03-07 11:35:13 +01:00
parent 492fe3a6cf
commit 4e2072a267
1 changed files with 59 additions and 61 deletions

View File

@ -31,48 +31,46 @@ var paths = cfg.paths;
gulp.task( 'scss-for-prod', function() { gulp.task( 'scss-for-prod', function() {
var source = gulp.src( paths.sass + '/*.scss' ) var source = gulp.src( paths.sass + '/*.scss' )
.pipe(plumber({ .pipe(plumber({
errorHandler: function (err) { errorHandler: function ( err ) {
console.log(err); console.log( err );
this.emit('end'); this.emit( 'end' );
} }
})) }))
.pipe(sourcemaps.init({loadMaps: true})) .pipe( sourcemaps.init({loadMaps: true}) )
.pipe(sass()); .pipe( sass() );
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() )
.pipe(minify-css()) .pipe(minify-css())
.pipe(rename({suffix: '.min'})) .pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(paths.css)); .pipe(gulp.dest(paths.css));
return merge(pipe1, pipe2); return merge(pipe1, pipe2);
}); });
// Run: // Run:
// gulp sourcemaps + sass + reload(browserSync) // gulp sourcemaps + sass + reload(browserSync)
// Prepare the child-theme.css for the development environment // Prepare the child-theme.css for the development environment
gulp.task( 'scss-for-dev', function() { gulp.task( 'scss-for-dev', function() {
gulp.src(paths.sass + '/*.scss') gulp.src( paths.sass + '/*.scss' )
.pipe(plumber({ .pipe(plumber({
errorHandler: function (err) { errorHandler: function ( err ) {
console.log(err); console.log( err );
this.emit('end'); this.emit( 'end' );
} }
})) }))
.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 () {
gulp.watch(paths.sass + '/**/*.scss', ['scss-for-dev']); gulp.watch( paths.sass + '/**/*.scss', ['scss-for-dev'] );
}); });
@ -80,17 +78,17 @@ gulp.task( 'watch-scss', ['browser-sync'], function () {
// gulp sass // gulp sass
// Compiles SCSS files in CSS // Compiles SCSS files in CSS
gulp.task( 'sass', function () { gulp.task( 'sass', function () {
var stream = gulp.src(paths.sass + '/*.scss') var stream = gulp.src( paths.sass + '/*.scss' )
.pipe(plumber({ .pipe( plumber( {
errorHandler: function (err) { errorHandler: function ( err ) {
console.log(err); console.log( err );
this.emit('end'); this.emit( 'end' );
} }
})) } ) )
.pipe(sass({errLogToConsole: true})) .pipe( sass( {errLogToConsole: true} ) )
.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;
}); });
@ -99,8 +97,8 @@ gulp.task( 'sass', function () {
// gulp watch // gulp watch
// Starts watcher. Watcher runs gulp sass task on changes // Starts watcher. Watcher runs gulp sass task on changes
gulp.task( 'watch', function () { gulp.task( 'watch', function () {
gulp.watch(paths.sass + '/**/*.scss', ['styles']); gulp.watch( paths.sass + '/**/*.scss', ['styles'] );
gulp.watch([paths.dev + '/js/**/*.js','js/**/*.js','!js/theme.js','!js/theme.min.js'], ['scripts']); gulp.watch( [paths.dev + '/js/**/*.js','js/**/*.js','!js/theme.js','!js/theme.min.js'], ['scripts'] );
//Inside the watch task. //Inside the watch task.
gulp.watch(paths.imgsrc + '/**', ['imagemin-watch']); gulp.watch(paths.imgsrc + '/**', ['imagemin-watch']);
@ -110,7 +108,7 @@ gulp.task( 'watch', function () {
* Ensures the 'imagemin' task is complete before reloading browsers * Ensures the 'imagemin' task is complete before reloading browsers
* @verbose * @verbose
*/ */
gulp.task( 'imagemin-watch', ['imagemin'], function(done) { gulp.task( 'imagemin-watch', ['imagemin'], function( done ) {
browserSync.reload(); browserSync.reload();
done(); done();
}); });
@ -119,9 +117,9 @@ gulp.task( 'imagemin-watch', ['imagemin'], function(done) {
// gulp imagemin // gulp imagemin
// Running image optimizing task // Running image optimizing task
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) );
}); });
@ -129,42 +127,42 @@ gulp.task( 'imagemin', function(){
// gulp cssnano // gulp cssnano
// Minifies CSS files // Minifies CSS files
gulp.task( 'cssnano', function(){ gulp.task( 'cssnano', function(){
return gulp.src(paths.css + '/theme.css') return gulp.src( paths.css + '/theme.css' )
.pipe(sourcemaps.init({loadMaps: true})) .pipe( sourcemaps.init( {loadMaps: true} ) )
.pipe(plumber({ .pipe( plumber ({
errorHandler: function (err) { errorHandler: function ( err ) {
console.log(err); console.log( err );
this.emit('end'); this.emit( 'end' );
} }
})) }))
.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() {
return gulp.src(paths.css + '/theme.css') return gulp.src( paths.css + '/theme.css' )
.pipe(sourcemaps.init({loadMaps: true})) .pipe( sourcemaps.init( {loadMaps: true} ) )
.pipe(cleanCSS({compatibility: '*'})) .pipe( cleanCSS( {compatibility: '*'} ) )
.pipe(plumber({ .pipe( plumber({
errorHandler: function (err) { errorHandler: function ( err ) {
console.log(err); console.log( err) ;
this.emit('end'); this.emit( 'end' );
} }
})) }) )
.pipe(rename({suffix: '.min'})) .pipe( rename( {suffix: '.min'} ) )
.pipe(sourcemaps.write('./')) .pipe( sourcemaps.write( './' ) )
.pipe(gulp.dest(paths.css)); .pipe( gulp.dest( paths.css ) );
}); });
gulp.task( 'cleancss', function() { gulp.task( 'cleancss', function() {
return gulp.src(paths.css + '/*.min.css', { read: false }) // much faster return gulp.src( paths.css + '/*.min.css', { read: false } ) // much faster
.pipe(ignore('theme.css')) .pipe(ignore( 'theme.css') )
.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: