Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/byroot/sprockets-svg
SVG toolchain for sprockets
https://github.com/byroot/sprockets-svg
Last synced: 5 days ago
JSON representation
SVG toolchain for sprockets
- Host: GitHub
- URL: https://github.com/byroot/sprockets-svg
- Owner: byroot
- License: mit
- Created: 2014-04-12T16:44:34.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-12-11T09:30:46.000Z (about 4 years ago)
- Last Synced: 2024-04-26T04:45:51.239Z (8 months ago)
- Language: Ruby
- Size: 108 KB
- Stars: 10
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/byroot/sprockets-svg.svg)](https://travis-ci.org/byroot/sprockets-svg)
[![Code Climate](https://codeclimate.com/github/byroot/sprockets-svg.png)](https://codeclimate.com/github/byroot/sprockets-svg)
[![Gem Version](https://badge.fury.io/rb/sprockets-svg.png)](http://badge.fury.io/rb/sprockets-svg)# Sprockets::Svg
SVG toolchain for sprockets
## Installation
And then execute:
$ bundle
Or install it yourself as:
$ gem install sprockets-svg
## Usage
### Ruby on Rails
Add this line to your application's Gemfile:
```ruby
gem 'sprockets-svg'
```From now on, svg files will be automatically optimised.
To link the png version of `picture.svg` from scss:
```scss
#id {
background-image: image-url(picture.svg.png)
}
```or from a view:
```erb
<%= image_tag 'picture.svg.png' %>
```### Standalone Sprockets
If you are using sprockets outside of Rails, to setup `sprockets-svg` you just need:
```ruby
assets = Sprockets::Environment.new do |env|
# Your assets settings
endrequire "sprockets-svg"
Sprockets::Svg.install(assets)
```## Optimizations
For now the only optimization performed is to remove hidden elements.
In the future I'd like to rely on the [`svgo` toolchain](https://github.com/svg/svgo).
## Contributing
1. Fork it ( http://github.com//sprockets-svg/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request