0.19.0 • Published 1 month ago
@hidoo/gulp-task-build-sprite-svg v0.19.0
@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-svg
Usage
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
options
Object option (optional, default{}
)options.name
String task name (use as displayName) (optional, default'build:sprite'
)options.src
String source pathoptions.destImg
String destination image pathoptions.destCss
String destination css pathoptions.imgName
String destination image filenameoptions.cssName
String destination css filenameoptions.imgPath
String destination image path in cssoptions.padding
Number padding between image in sprite sheet (optional, default2
)options.layout
String layout for generate sprite sheet(one of [packed|vertical|horizontal]) (optional, default'packed'
)options.cssPreprocessor
String type of css preprocessor (one of [stylus|sass|sass:module]). (optional, default'stylus'
)options.cssTemplate
String Handlebars template for css.options.cssPreprocessor
is ignored if this value is specified. see: default template (optional, defaultpath.resolve(__dirname,'../template/stylus.hbs')
)options.cssHandlebarsHelpers
Object Handlebars helpers (optional, defaultrequire('@hidoo/handlebars-helpers')
)options.verbose
Boolean 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 test
License
MIT
1.0.0-alpha.1
1 month ago
1.0.0-alpha.0
3 months ago
0.19.0
3 years ago
0.18.0
3 years ago
0.17.0
3 years ago
0.16.0
3 years ago
0.15.0
4 years ago
0.14.1
4 years ago
0.14.0
4 years ago
0.13.0
5 years ago
0.12.0
5 years ago
0.11.0
5 years ago
0.10.0
5 years ago
0.9.0
5 years ago
0.8.4
5 years ago
0.8.3
5 years ago
0.8.2
5 years ago
0.8.1
5 years ago
0.8.0
5 years ago
0.7.0
5 years ago
0.6.2
6 years ago
0.6.1
6 years ago
0.6.0
6 years ago
0.5.0
6 years ago
0.4.0
6 years ago
0.3.0
6 years ago
0.2.1
6 years ago
0.2.0
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago