breezy-svg-optimization
by Jhey Tompkins
Optimize SVG on drop
// Menu: SVGO// Description: Optimize SVG on drop// Author: Jhey Tompkins// Twitter: @jh3yylet svgo = await npm('svgo')let { setSelectedText } = await kit('text')let [svg] = await arg({placeholder: 'Drop an SVG',drop: true,ignoreBlur: true,})const SVG_STRING = await readFile(svg.path, 'utf-8')// My SVGO configconst CONFIG = {...}// Optimize it using my preferred configlet result = await svgo.optimize(SVG_STRING, CONFIG)// Write to fileawait writeFile(svg.path.replace('.svg', '--optimized.svg'), result.data)// Copy to clipboardsetSelectedText(result.data)