Skip to content

Instantly share code, notes, and snippets.

@jkphl
Last active December 12, 2015 12:36
Show Gist options
  • Save jkphl/896e052f929803ce23ef to your computer and use it in GitHub Desktop.
Save jkphl/896e052f929803ce23ef to your computer and use it in GitHub Desktop.
Creating an example SVG icon grid with names for easy referencing

Running svg-sprite, grunt-svg-sprite or gulp-svg-sprite with the following minimal configuration

var config       = {
    "mode": {
        "css": {
            "render": {
                "css": true
            },
            "example": true
        }
    }
};

should result in the this output (cache busting hash omitted for clarity):

out/
`-- css
    |-- sprite.css
    |-- sprite.css.html
    `-- svg
        `-- sprite.css.svg

The example file sprite.css.html should display all shapes in your sprite along with their names, please see the attached screenshot. (At the time of this writing, I experience a strange display error in Chrome when using the view sprite as background image, but all other major browsers seem to work ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment