TIL is my collection of short, technical daily learnings. 200 and counting.
Install SVGO With Reasonable Defaults
A project I’m working on uses SVGO to clean and minify SVG files. There’s one problem: SVGO by default removes the viewBox attribute, which comes embedded in the SVG’s I receive and have stylistic meaning in my codebase. You can override this default by using an SVGO config file: // svgo.config.js module.exports = { plugins: [ { name: 'preset-default', params: { overrides: { removeViewBox: false, }, }, }, ], }; Applied like so: ...