Giter Club home page Giter Club logo

wp-svg-spritemap's Introduction

SVG Spritemap

SVG Spritemap is a WordPress plugin that lets you add SVGs with the Media Uploader, as well as create and manage an SVG spritemap from your Media Library.

Screenshot

  1. Install and activate the WordPress plugin.
  2. Add SVG images through the Media Uploader.
  3. Select the SVGs for the spritemap in Settings > Media > SVG Spritemap.

After selecting and updating the SVGs for your spritemap, a combined defs.svg SVG spritemap is automatically generated.

Using Icons

A text field displays the URL to the SVG spritemap. Individuals sprites may be referenced by appending #: and the name of the sprite to the URL.

<svg><use xlink:href="http://dev.wordpress/wp-content/plugins/svg-spritemap/defs.svg#:accounts"></svg>

Shortcode

Simplify including icons within Wordpress by using the [svgmap] shortcode in the editors. Set the required sprite attribute and an <svg> tag will be inserted in your page/post with the desired SVG image. All other shortcode parameters will be added to the inserted <svg> as attributes, allowing you to set class, fill, width, height and more.

Shortcode

[svgmap sprite="accounts" width="100" height="100" fill="#F00" class="icon"]

Output:

<svg width="100" height="100" fill="#F00" class="icon"><use xlink:href="http://dev.wordpress/wp-content/plugins/svg-spritemap/defs.svg#:accounts"></svg>

Note: To change the fill or stroke of your SVG, do not include those attributes in the uploaded SVG. The included SVG's attributes override anything set on the <use> or <svg>.

Filesize

The live, estimated filesize of the spritemap represents the combined filesize of all the individual SVGs, but it does not factor in additional gzip compression. More than likely, the estimation will be conservative and the filesize will actually be smaller than the estimation.

Browser Support

Internet Explorer requires special assistance to display external SVGs. To resolve this issue, I have developed SVG4Everybody.

wp-svg-spritemap's People

Contributors

jonathantneal avatar mikeescobedo avatar shshaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-svg-spritemap's Issues

svgmap_pre_post_update throws error on menu save

I realize it has been awhile since anything has been done here but I was just curious as to why the add_action('pre_post_update', 'svgmap_pre_post_update') has been left in the code? Is there a plan for adding the function or was that old code?

An error, function not found, is thrown whenever I save a menu.

Clean up/minify SVGs when uploaded

Basically like running files through svgmin when creating sprites with Grunt/Gulp - would be awesome to have that here! Particularly if you are using SVGs from Illustrator they are super bloated by default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.