How to use the gulp-imagemin.gifsicle function in gulp-imagemin

To help you get started, we’ve selected a few gulp-imagemin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imweb / generator-imweb-wxapp / generators / app / templates / gulpfile.js View on Github external
function img() {
  return src(`${srcDir}/**/*.{png,jpe?g,gif,svg}`)
    .pipe(
      cache(
        imagemin([
          imagemin.gifsicle({ interlaced: true }),
          imagemin.jpegtran({ progressive: true }),
          imagemin.optipng({ optimizationLevel: 4 }),
          imagemin.svgo({
            plugins: [
              { removeDimensions: true }, // 如果有 viewbox 则不需要 width 和 height
            ],
          }),
        ])
      )
    )
    .pipe(
      dest(file => {
        return file.base; // 压缩到原目录
      })
    );
}
github maliMirkec / starter-project-cli / gulpfile.js / gfx.js View on Github external
function gfxStart () {
  return src(helpers.trim(`${helpers.source()}/${global.config.gfx.src}/**/*`))
    .pipe(imagemin([
      imagemin.gifsicle(gfxConfig.gifConfig),
      imageminMozjpeg(gfxConfig.jpegConfig),
      imageminPngquant(gfxConfig.pngConfig),
      imagemin.svgo(gfxConfig.svgConfig)
    ]))
    .pipe(dest(helpers.trim(`${helpers.dist()}/${global.config.gfx.dist}`)))
    .pipe(gulpif(global.config.sync.run, global.bs.stream()))
}
github MinnPost / object-sync-for-salesforce / Gulpfile.js View on Github external
function images() {
  return gulp.src(config.images.docs_src)
    .pipe(
      imagemin([
        imagemin.gifsicle({ interlaced: true }),
        imagemin.jpegtran({ progressive: true }),
        imagemin.optipng({ optimizationLevel: 5 }),
        imagemin.svgo({
          plugins: [
            {
              removeViewBox: false,
              collapseGroups: true
            }
          ]
        })
      ])
    )
    .pipe(gulp.dest(config.images.docs_dest));
}
github atolye15 / web-starter-kit / gulp / tasks / images.js View on Github external
export function imagesOptimize() {
  return gulp
    .src([`${configs.paths.src}/img/**/*`, `!${configs.paths.src}/img/{icons,icons/**}`])
    .pipe(newer('.cache/img'))
    .pipe(
      imagemin([
        imagemin.gifsicle({ interlaced: true }),
        imageminMozjpeg({ progressive: true }),
        imageminPngquant({
          quality: [0.6, 0.8],
        }),
        imagemin.svgo({ plugins: [{ removeDimensions: true }] }),
      ]),
    )
    .pipe(gulp.dest('.cache/img'))
    .on('error', notifierErrorHandler);
}
github chalkygames123 / front-end-template / gulpfile.js / tasks / images.js View on Github external
})
    .pipe(
      gulpIf(
        isDev,
        gulpChanged(
          path.join(config.get('distDir'), config.get('site.basePath'))
        )
      )
    )
    .pipe(
      gulpIf(
        !isDev,
        gulpImagemin([
          imageminPngquant(),
          imageminMozjpeg(),
          gulpImagemin.gifsicle({
            optimizationLevel: 3
          }),
          gulpImagemin.svgo({
            plugins: [
              { removeViewBox: false },
              { removeUnknownsAndDefaults: false },
              { removeUselessDefs: false },
              { cleanupIDs: false }
            ]
          })
        ])
      )
    )
    .pipe(detectConflict())
    .pipe(
      gulp.dest(path.join(config.get('distDir'), config.get('site.basePath')))
github theme-my-login / theme-my-login / gulpfile.js View on Github external
function images() {
	return gulp.src([
		'src/assets/images/**/*'
	])
	.pipe(gulpImagemin([
		gulpImagemin.gifsicle({interlaced: true}),
		gulpImagemin.mozjpeg({quality: 75, progressive: true}),
		gulpImagemin.optipng({optimizationLevel: 5}),
		gulpImagemin.svgo({
			plugins: [
				{removeViewBox: true},
				{cleanupIDs: false}
			]
		})
	]))
	.pipe(gulp.dest('build/assets/images'));
}
github atolye15 / web-starter-kit / gulp / tasks / images / optimize.js View on Github external
return function() {
    return gulp
      .src([`${configs.paths.src}/img/**/*`, `!${configs.paths.src}/img/{icons,icons/**}`])
      .pipe(plumber({ errorHandler: notify.onError('Hata: <%= error.message %>') }))
      .pipe(newer('.tmp/img'))
      .pipe(
        imagemin([
          imagemin.gifsicle({ interlaced: true }),
          imagemin.jpegtran({ progressive: true }),
          imagemin.optipng({ optimizationLevel: 5 }),
          imagemin.svgo({ plugins: [{ removeDimensions: true }] }),
        ]),
      )
      .pipe(gulp.dest('.tmp/img'));
  };
}
github colinrotherham / core / src / tasks / img / optimise.js View on Github external
export default (config, gulp) => {

  const options = config.options || [
    imagemin.gifsicle(),
    imagemin.jpegtran({
      progressive: true,
    }),
    imagemin.optipng(),
    imagemin.svgo({
      plugins: [{
        removeViewBox: false,
      }],
    }),
  ];

  return () => gulp.src(config.src, { dot: true })
    .pipe(imagemin(options))
    .pipe(gulp.dest(config.dest));
};

gulp-imagemin

Minify PNG, JPEG, GIF and SVG images

MIT
Latest version published 7 months ago

Package Health Score

69 / 100
Full package analysis