 # lazyload & webp tasks
 # ================================================================= 
 
+gulp.task "img:make", (cb)->
+  return runSequence  'webp:make',
+                      'img:make:previews'
+                      cb
+
+gulp.task "img:clean", (cb)->
+  return runSequence  'jpeg:format',
+                      'jpeg:clean'
+                      cb
+
+gulp.task "jpeg:clean", ->
+  return gulp.src('contents/media/images/**/*.{jpeg}',{read:false})
+          .pipe(clean())
+
+gulp.task "jpeg:format", ->
+  return gulp.src('contents/media/images/**/*.{jpeg}',{base: './'})
+    .pipe plumber()
+    .pipe imgResize({format: 'jpg'})
+    .pipe(gulp.dest('./'))
+
 gulp.task 'img:make:previews', ->
   options = {
     resize: [20,20],

                new RegExp('^.parsley-.*')
                new RegExp('^.datalist.*')
                new RegExp('^li.active.*')
                ]
                ))
    .pipe(gulp.dest('build/css'))


gulp.task "preview", (cb)->
  return runSequence  ['build:clean', 'js:clean'],
                      ['css:build','js:build'],
                      'build_wintersmith',
                      'webp:make',
                      'css:clean',
                      cb

