Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svg_spriter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg_spriter

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

SvgSpriter

Take a directory of SVG files, optimize them, and compile them into a single sprite file using <symbol> elements.

Use case for SVG sprites: https://css-tricks.com/svg-sprites-use-better-icon-fonts

This gem is based off svg-sprite for npm. It will allow you to use SVG sprites while only maintaining one instance of an SVG. Originally built for Nanoc to build a sprite when compiling site, but can be used in any Ruby application that can compile a site.

Installation

Add this line to your application’s Gemfile:

gem 'svg_spriter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install svg_spriter

Usage

During compiling, run:

sprite_svg(source: 'source', output: 'output')

where source is something like /static/svg. Output is optional, and will use the source if not specified.

TODO

  • Allow for more robust SVGs. Currently only simple SVGs compile reliably
  • Allow for subdirectories of source directory
  • Add more tests for checking integrity of compiled sprite
  • Handle SVGs with duplicate ids

Author’s note

This is my first RubyGem, and my experience with Ruby is limited. This was a way for me to learn more about Ruby and RubyGems, and I don't pretend to know the best way to do things in Ruby. So, any contributions or suggestions for this gem are appreciated.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kylesimmonds/svg_spriter.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 06 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc