Skip to content
Creeper edited this page Feb 18, 2016 · 3 revisions

API Doc

1. generateSprite(sourceList, options)

Desc: generate sprite from image path list or a dir.

@param  {Array|String} sourceList             source images list, or source image dir
@param  {Object}       options                setting:
        {String}       options.dest           required, dest image path
        {String}       options.retinaDest     dest retina image path
        {Boolean}      options.retina         whether to enable retina mode
        {Function}     options.filter         filter out normal image
        {Function}     options.retinaFilter   filter out retina image
        {Number}       options.margin         margin between icons
        {Boolean}      options.compression    output png compression, oneof ['none', 'fast', 'high']
        {Boolean}      options.interlaced     enable png interlaced
        {String}       options.arrangement    arrangement of images: 'vertical'|'horizontal'|'compact'

@return {Object}                              promise

2. generateStyle(infoList, options)

Desc: generate style from info list (every item contains width, height, image path ...).

@param  {Array}   infoList                The images (merged to sprite) info list, generated by `generateSprite`
@param  {Object}  options                 options
        {String}  options.connector       className connector, default to "-"
        {String}  options.prefix          className prefix, default to "icon"
        {String}  options.suffix          className suffix
        {Boolean} options.retina          generate retina style
        {Boolean} options.writeToFile     whether write style to file
        {String}  options.stylePath       style path
        {String}  options.imagePath       image path
        {String}  options.retinaImagePath retina image path
        {Boolean} options.banner          whether write banner to style
@return {String}                          generated style text
Clone this wiki locally