Guest User

Untitled

a guest
Oct 20th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. var src = "___library/7-kazan/1/*";
  2. var dst = "_ready";
  3.  
  4. var gulp = require('gulp'),
  5. imagemin = require('gulp-imagemin'),
  6. cache = require('gulp-cache'),
  7. del = require('del'),
  8. imageResize = require('gulp-image-resize'),
  9. watermark = require("gulp-watermark"),
  10. rename = require("gulp-rename");
  11.  
  12. gulp.task('image', ['imagesmall'], function() {
  13. return gulp.src(src)
  14. .pipe(imageResize({
  15. width : 1920,
  16. height : 1080,
  17. crop : true,
  18. upscale : true
  19. }))
  20. .pipe(watermark({
  21. image: "watermark.png"
  22. }))
  23. .pipe(rename(function (path) {path.basename = path.basename.replace('Depositphotos_', '')}))
  24. .pipe(rename(function (path) {path.basename = path.basename.replace('_original', '')}))
  25. .pipe(cache(imagemin()))
  26. .pipe(gulp.dest(dst));
  27. });
  28.  
  29. gulp.task('imagesmall', function() {
  30. return gulp.src(src)
  31. .pipe(imageResize({
  32. width : 760,
  33. height : 428,
  34. crop : true,
  35. upscale : true
  36. }))
  37. .pipe(watermark({
  38. image: "watermark.png"
  39. }))
  40. .pipe(rename(function (path) {path.basename = path.basename.replace('Depositphotos_', '')}))
  41. .pipe(rename(function (path) {path.basename = path.basename.replace('_original', '')}))
  42. .pipe(cache(imagemin({progressive: true})))
  43. .pipe(gulp.dest(dst + '/small'));
  44. });
  45.  
  46. gulp.task('clearcache', function () { return cache.clearAll(); });
  47. gulp.task('cleaready', function() { return del.sync(dst); });
  48.  
  49. gulp.task('default', ['image']);
Add Comment
Please, Sign In to add comment