Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var src = "___library/7-kazan/1/*";
- var dst = "_ready";
- var gulp = require('gulp'),
- imagemin = require('gulp-imagemin'),
- cache = require('gulp-cache'),
- del = require('del'),
- imageResize = require('gulp-image-resize'),
- watermark = require("gulp-watermark"),
- rename = require("gulp-rename");
- gulp.task('image', ['imagesmall'], function() {
- return gulp.src(src)
- .pipe(imageResize({
- width : 1920,
- height : 1080,
- crop : true,
- upscale : true
- }))
- .pipe(watermark({
- image: "watermark.png"
- }))
- .pipe(rename(function (path) {path.basename = path.basename.replace('Depositphotos_', '')}))
- .pipe(rename(function (path) {path.basename = path.basename.replace('_original', '')}))
- .pipe(cache(imagemin()))
- .pipe(gulp.dest(dst));
- });
- gulp.task('imagesmall', function() {
- return gulp.src(src)
- .pipe(imageResize({
- width : 760,
- height : 428,
- crop : true,
- upscale : true
- }))
- .pipe(watermark({
- image: "watermark.png"
- }))
- .pipe(rename(function (path) {path.basename = path.basename.replace('Depositphotos_', '')}))
- .pipe(rename(function (path) {path.basename = path.basename.replace('_original', '')}))
- .pipe(cache(imagemin({progressive: true})))
- .pipe(gulp.dest(dst + '/small'));
- });
- gulp.task('clearcache', function () { return cache.clearAll(); });
- gulp.task('cleaready', function() { return del.sync(dst); });
- gulp.task('default', ['image']);
Add Comment
Please, Sign In to add comment