SVG optimization within Emacs with SVGO
This package uses the Node utility SVGO to optimize SVG files. It provides a command to reduce the size of the SVG contents in the current Emacs buffer.
To install this package you should use use-package
, like so:
(use-package svgo
:hook
(nxml-mode . (lambda () (bind-key "M-o" 'svgo nxml-mode-map)))
(image-mode . (lambda () (bind-key "M-o" 'svgo image-mode-map))))
Also make sure you have Node/NPM installed on your machine.
After opening a SVG file in Emacs, you can execute M-x svgo
or, with the key bindings configured as suggested above, press M-o
to optimize the file (either in image-mode
or after toggling the image display with C-c C-c
in nxml-mode
).
If the svgo
NPM package is missing you will be prompted to automatically install it.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.