How to use gulp-svgmin - 10 common examples

To help you get started, we’ve selected a few gulp-svgmin 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 localnerve / react-pwa-reference / src / build / ccss.js View on Github external
function svgmin (settings) {
  return gulp.src('**/*.svg', {
    cwd: settings.assets.images
  })
    .pipe(
      gulpSvgmin()
    )
    .pipe(
      gulp.dest(settings.dist.images)
    );
}
github CircularRhythm / CircularRhythm / gulpfile.babel.js View on Github external
g.task("svg_minify", () => g.src("asset/**/*.svg").pipe(svgMin()).pipe(g.dest("build/asset/")).pipe(liveReload()))
github kreativgebiet / kickup / tasks / markup.js View on Github external
gulp.task('sprites', () => {
  gulp.src(join(src, 'images', '**/*.svg'))
    .pipe(svgmin())
    .pipe(cheerio({
      run($) { $('[fill]').removeAttr('fill'); },
      parserOptions: { xmlMode: true },
    }))
    .pipe(svgstore({ inlineSvg: true }))
    .pipe(concat('sprites.ejs'))
    .pipe(gulp.dest(join(src, 'html', 'partials')));
});
github animify / Minicons / gulpfile.babel.js View on Github external
gulp.task('minify', () =>
    gulp.src('icons/*.svg')
        .pipe(svgmin({
            plugins: [
                {
                    removeTitle: true,
                },
                {
                    mergePaths: false,
                },
                {
                    convertShapeToPath: false,
                },
                {
                    removeAttrs: {
                        attrs: '(fill|stroke.*)',
                    },
                },
            ],
github Skyscanner / backpack / packages / bpk-svgs / gulpfile.babel.js View on Github external
gulp.task('spinners', () => {
  const optimised = gulp
    .src('src/spinners/**/*.svg')
    .pipe(chmod(0o644))
    .pipe(
      svgmin({
        plugins: [
          ...svgoCommonPlugins,
          {
            removeAttrs: {
              attrs: ['id', 'class', 'data-name', 'fill', 'fill-rule'],
            },
          },
        ],
      }),
    )
    .pipe(gulp.dest('src/spinners'));

  const react = optimised
    .pipe(clone())
    .pipe(svg2react())
    .pipe(rename({ extname: '.js' }))
github thecreation / gulp-starter-kit / tasks / svgs.js View on Github external
gulp.task('svgs', () => {
  return gulp
    .src(`${config.svgs.source}/**/*`)
    .pipe(changed(`${config.svgs.build}`))
    .pipe(
      plumber({errorHandler: notify.onError('Error: <%= error.message %>')})
    )
    .pipe(
      svgmin({
        js2svg: {
          pretty: true,
        },
        plugins: [
          {
            removeDesc: true,
          },
          {
            cleanupIDs: true,
          },
          {
            mergePaths: false,
          },
        ],
      })
    )
github flekschas / d3-list-graph / gulpfile.babel.js View on Github external
gulp.task('svg', () => gulp
  .src(config.globalPaths.src + config.sourcePaths.images + '/*.svg')
  .pipe(svgmin({
    plugins: [
      {
        removeTitle: true
      },
      {
        cleanupIDs: false
      }
    ]
  }))
  .pipe(gulp.dest(config.globalPaths.dist))
);
github ONSdigital / eq-survey-runner / gulp / images.js View on Github external
export function svg() {
  gulp.src(paths.svgs.input)
    .pipe(plumber())
    .pipe(tap((file, t) => {
      if (file.isDirectory()) {
        let name = file.relative + '.svg'
        gulp.src(file.path + '/**/*.svg')
          .pipe(svgstore({
            fileName: name,
            prefix: 'icon-',
            inlineSvg: true
          }))
          .pipe(gulp.dest(paths.svgs.output))
      }
    }))
    .pipe(svgmin())
    .pipe(size({'title': 'SVG'}))
    .pipe(gulp.dest(paths.svgs.output))
}
github ournameismud / mud-fractal / gulp / tasks / sprites.js View on Github external
process.env.PWD,
			PATH_CONFIG.public,
			PATH_CONFIG.sprites.dest
		)
	}

	TASK_CONFIG.sprites.mode.css.render.scss.dest = `/_assets/${PATH_CONFIG.scss
		.src}/${dest}`
	TASK_CONFIG.sprites.mode.css.render.scss.template = path.resolve(
		process.env.PWD,
		template
	)

	return gulp
		.src(paths.src)
		.pipe(svgmin())
		.pipe(svgSprite(TASK_CONFIG.sprites))
		.pipe(gulp.dest(paths.dest))
		.pipe(browserSync.stream())
}
github KawashiroNitori / Anubis / gulpfile.babel.js View on Github external
gulp.task('iconfont', () => {
    return gulp
        .src('anubis/ui/misc/icons/*.svg')
        .pipe(svgmin())
        .pipe(gulp.dest('anubis/ui/misc/icons'))
        .pipe(iconfont({
            fontHeight: 1000,
            prependUnicode: false,
            descent: 6.25 / 100 * 1000,
            fontName: 'anubisIcon',
            formats: ['svg', 'ttf', 'eot', 'woff', 'woff2'],
            timestamp: iconTimestamp,
            normalize: true,
        }))
        .on('glyphs', (glyphs, options) => {
            gulp
                .src('anubis/ui/misc/icons/template/*.styl')
                .pipe(nunjucks.compile({glyphs, options}))
                .pipe(gulp.dest('anubis/ui/misc/.iconfont'))
        })

gulp-svgmin

Minify SVG files with gulp.

MIT
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis

Popular gulp-svgmin functions