Add svg-sprite support in Poi.
npm i -g poi-preset-svg-sprite
// poi.config.js
module.exports = {
presets: [
require('poi-preset-svg-sprite')()
]
}
// index.js
import demo from './demo.svg'
const rendered = `
<svg>
<use xlink:href="${demo.url}" />
</svg>
<img src="${demo.url}" alt="">
`;
// poi.config.js
module.exports = {
presets: [
require('poi-preset-svg-sprite')({extract: false})
]
}
// index.js
import demo from './demo.svg'
const rendered = `
<svg>
<use xlink:href="#${demo.id}" />
</svg>
`;
Add svg-sprite support in Poi.
Parameters
options
Objectoptions.include
(String | Array<String>)? Specific directory for svg filesoptions.svgSpriteOptions
Object svg-sprite-loader options See svg-sprite-loader options (optional, default{ extract:true }
)options.svgSpritePluginOptions
Object svg-sprite-loader-plugin options See svg-sprite-loader-plugin options (optional, default{}
)options.svgoOptions
Object svgo-loader options See svgo-loader options (optional, default{ plugins:[] }
)