SVG toolchain for sprockets
And then execute:
$ bundle
Or install it yourself as:
$ gem install sprockets-svg
Add this line to your application's Gemfile:
gem 'sprockets-svg'
From now on, svg files will be automatically optimised.
To link the png version of picture.svg
from scss:
#id {
background-image: image-url(picture.svg.png)
}
or from a view:
<%= image_tag 'picture.svg.png' %>
If you are using sprockets outside of Rails, to setup sprockets-svg
you just need:
assets = Sprockets::Environment.new do |env|
# Your assets settings
end
require "sprockets-svg"
Sprockets::Svg.install(assets)
For now the only optimization performed is to remove hidden elements.
In the future I'd like to rely on the svgo
toolchain.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)