Noamyoungerm/metalsmith-spritesmith


A Metalsmith plugin for creating spritesmith sprites

License: MIT

Language: JavaScript


Metalsmith-Spritesmith

npm install metalsmith-spritesmith

This plugin lets you use Metalsmith to sprite images through spritesmith

Usage (basic)

var spritesmith = require('metalsmith-spritesmith');

metalsmith(__dirname)
  ...

  .use(spritesmith({
    src: '**/*.png'
    image_dest: './images/sprites.png',
    css_dest: './sprites.css',
  }))

  ...

Usage (advanced)

var spritesmith = require('metalsmith-spritesmith');

metalsmith(__dirname)
  ...

  .use(spritesmith({
    src: '**/*.png'
    image_dest: './images/sprites.png',
    css_dest: './sprites.css',

    spritesmith: { // Options for spritesmith.processImages
      padding: 2
    },

    templater: { // Options for spritesmith templates
      format: 'css',
      formatOpts: {
        cssSelector: function(sprite) {
          return sprite.name.replace(/\:\:/g, ':');
        }
      }
    }
  }))

  ...

Options

src: Minimatch selector for input files (e.g. **/*.png)

image_dest: Output path for spritesheet

css_dest: Output path for CSS file

spritesmith: Options that will be passed to spritesmith.processImages

templater: Options for spritesmith templater

Project Statistics

Sourcerank 3
Repository Size 4.88 KB
Stars 0
Forks 1
Watchers 1
Open issues 1
Dependencies 4
Contributors 1
Tags 0
Created
Last updated
Last pushed

Top Contributors See all

Noam Youngerman

Packages Referencing this Repo

metalsmith-spritesmith
Metalsmith plugin for creating sprites through spritesmith
Latest release 1.0.1 - Updated

Something wrong with this page? Make a suggestion

Last synced: 2016-07-29 15:43:00 UTC

Login to resync this repository