1.0.0-alpha.4 • Published 5 months ago
@hidoo/gulp-task-build-sprite-svg v1.0.0-alpha.4
@hidoo/gulp-task-build-sprite-svg
Task that build svg sprite sheet for gulp.
Installation
$ npm install --save-dev gulp@next @hidoo/gulp-task-build-sprite-svgUsage
import { task } from 'gulp';
import buildSprite from '@hidoo/gulp-task-build-sprite-svg';
task(
'sprite',
buildSprite({
src: '/path/to/sprite/*.svg',
destImg: '/path/to/dest/image',
destCss: '/path/to/dest/css',
imgName: 'sprite.svg',
cssName: 'sprite.styl',
imgPath: './image/sprite.svg'
})
);API
svgo
buildSprite
return build svg sprite sheet task
Parameters
optionsObject option (optional, default{})options.nameString task name (use as displayName) (optional, default'build:sprite')options.srcString source pathoptions.destImgString destination image pathoptions.destCssString destination css pathoptions.imgNameString destination image filenameoptions.cssNameString destination css filenameoptions.imgPathString destination image path in cssoptions.paddingNumber padding between image in sprite sheet (optional, default2)options.layoutString layout for generate sprite sheet(one of [packed|vertical|horizontal]) (optional, default'packed')options.cssPreprocessorString type of css preprocessor (one of [stylus|sass|sass:module]). (optional, default'stylus')options.cssTemplateString Handlebars template for css.options.cssPreprocessoris ignored if this value is specified. see: default template (optional, defaultpath.resolve(__dirname,'../template/stylus.hbs'))options.cssHandlebarsHelpersObject Handlebars helpers (optional, defaultrequire('@hidoo/handlebars-helpers'))options.verboseBoolean out log or not (optional, defaultfalse)
Examples
import {task} from 'gulp';
import buildSprite, {svgo} from '@hidoo/gulp-task-build-sprite-svg';
task('sprite', buildSprite({
name: 'sprite:main',
src: '/path/to/sprite/*.svg',
destImg: '/path/to/dest/image',
destCss: '/path/to/dest/css',
imgName: 'sprite.svg',
cssName: 'sprite.styl',
imgPath: './path/from/css/to/sprite/sprite.svg',
padding: 10,
layout: 'vertical',
cssPreprocessor: 'sass',
cssTemplate: '/path/to/template/sass.hbs',
cssHandlebarsHelpers: {hoge: (value) => value},
compress: {
imagemin: [svgo())]
},
verbose: true
}));Returns Function[Stream](https://nodejs.org/api/stream.html)
Test
$ pnpm testLicense
MIT
1.0.0-alpha.4
5 months ago
1.0.0-alpha.3
6 months ago
1.0.0-alpha.2
7 months ago
1.0.0-alpha.1
2 years ago
1.0.0-alpha.0
2 years ago
0.19.0
4 years ago
0.18.0
5 years ago
0.17.0
5 years ago
0.16.0
5 years ago
0.15.0
6 years ago
0.14.1
6 years ago
0.14.0
6 years ago
0.13.0
6 years ago
0.12.0
6 years ago
0.11.0
6 years ago
0.10.0
6 years ago
0.9.0
6 years ago
0.8.4
7 years ago
0.8.3
7 years ago
0.8.2
7 years ago
0.8.1
7 years ago
0.8.0
7 years ago
0.7.0
7 years ago
0.6.2
7 years ago
0.6.1
7 years ago
0.6.0
7 years ago
0.5.0
7 years ago
0.4.0
7 years ago
0.3.0
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago