Skip to content

Instantly share code, notes, and snippets.

View Excalibaard's full-sized avatar

Bart Sluis Excalibaard

View GitHub Profile
@Excalibaard
Excalibaard / vue-svgo-inline-loader.js
Created May 6, 2022 08:33
SVGO + Vue inline SVG loader
const { optimize, loadConfig } = require('svgo');
const { getOptions } = require('loader-utils');
async function loader(svg) {
const { configFile, ...options } = getOptions(this) || {};
let config;
if (typeof configFile === 'string') {
config = await loadConfig(configFile, this.context);
} else if (configFile !== false) {