Answer the question
In order to leave comments, you need to log in
How to understand the Gulp-newer plugin?
I have the following assembly where
Gulp:
CLI version 1.2.1
Local version 4.0.0-alpha.2
var gulp = require("gulp");
var autoprefixer = require('gulp-autoprefixer');
var useref = require('gulp-useref');
var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
var stylus = require('gulp-stylus');
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync').create();
var ftp = require( 'vinyl-ftp' );
var reload = browserSync.reload;
var fileinclude = require('gulp-file-include');
var axis = require('axis');
var jeet = require('jeet');
var htmlhint = require("gulp-htmlhint");
var rupture = require('rupture');
var data = require('gulp-data');
var jade = require('gulp-jade');
var notify = require('gulp-notify');
var pngquant = require('imagemin-pngquant');
var imageminMozjpeg = require('imagemin-mozjpeg');
var imagemin = require('gulp-imagemin');
var cache = require('gulp-cached');
var newer = require('gulp-newer');
var remember = require('gulp-remember');
gulp.task('imageJpg',function(){
return gulp.src('app/img/*.jpg')
.pipe(newer('dist/img/'))
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [imageminMozjpeg({quality: '60', speed: 11})]
}))
.pipe(gulp.dest('dist/img/'));
});
Answer the question
In order to leave comments, you need to log in
if before "imageJpg" you don't run cleanup of files in "dist/img/", then everything should work. For clarity, use gulp-debug
gulp.task('image', function() {
return gulp.src(path.src.image)
.pipe(newer(path.dest.image))
.pipe(debug({'title':' image'}))
.pipe(gulp.dest(path.dest.image));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question