Class: Svgeez::Optimizer
- Inherits:
-
Object
- Object
- Svgeez::Optimizer
- Defined in:
- lib/svgeez/optimizer.rb
Constant Summary collapse
- SVGO_VERSION =
'1.3.2'.freeze
- SVGO_VERSION_MESSAGE =
"svgeez relies on SVGO #{SVGO_VERSION}. Continuing with standard sprite generation...".freeze
- SVGO_NOT_INSTALLED =
'Unable to find `svgo` in your PATH. Continuing with standard sprite generation...'.freeze
Instance Method Summary collapse
Instance Method Details
#optimize(file_contents) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/svgeez/optimizer.rb', line 7 def optimize(file_contents) raise SVGO_NOT_INSTALLED unless installed? raise SVGO_VERSION_MESSAGE unless supported? `cat <<EOF | svgo --disable=cleanupIDs --disable=removeHiddenElems --disable=removeViewBox -i - -o -\n#{file_contents}\nEOF` rescue RuntimeError => exception logger.warn exception. end |