svg-sprite / svg-sprite

SVG sprites & stacks galore — A low-level Node.js module that takes a bunch of SVG files, optimizes them and bakes them into SVG sprites of several types along with suitable stylesheet resources (e.g. CSS, Sass, LESS, Stylus, etc.)

Home Page:https://github.com/svg-sprite/svg-sprite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accept Javascript config file

wojciechczerniak opened this issue · comments

Feature suggestion

CLI usage is quite limited in more advanced scenarios because args types can't accept functions. And moving those to config file does not help, as the only option we currently have is JSON file, which have the very same limitations. One of those limitations can be lifted if --config could accept JS module file, ie. like webpack.config.js or few other examples in the ecosystem.

const JSONConfigContent = fs.readFileSync(path.resolve(file));
const externalConfig = JSON.parse(JSONConfigContent);

Instead plain strings only, we could set functions and use external utilities, just like API config object can.

svg-sprite --config=svg-spirte.config.js