jamesmartin / inline_svg

Embed SVG documents in your Rails views and style them with CSS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Include SVGO (or some optimizer) before inlining

elliottregan opened this issue · comments

Removing comments is good, but more optimization features would be nice, too.

Similar concept for Webpack: https://github.com/webpack-contrib/svg-inline-loader

Thanks for the opening this issue and linking to the Webpack library, @elliottregan. ✨

One of the reasons for allowing custom transformations of SVGs is to keep the core code simple and easy to maintain, while allowing individual users to depend on third-party SVG optimizers if they choose.

Another strategy, involving even less runtime complexity, would be to optimize SVGs separately from this library, perhaps as part of the asset pipeline or other build/deploy step, which could then be cached at boot time.

I'd be happy to help you get either or both of these strategies working but I'm not convinced that adding extra SVG optimization to the core of this library is a worthwhile feature.

Thanks for the quick response! I think that optimizing the SVGs before deploying is the best route.

https://robots.thoughtbot.com/organized-workflow-for-svg <- that's what they did, and they also reference this helper.