Added the ability to define a public path

pull/1/head
WolverinDEV 2021-03-16 20:38:21 +01:00
parent b2408a9b2d
commit 6a79237b51
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "webpack-svg-sprite-generator",
"version": "5.0.1",
"version": "5.0.2",
"description": "",
"main": "plugin.js",
"types": "ts/index.d.ts",

View File

@ -20,7 +20,8 @@ export interface Options {
dtsOutputFolder: string,
configurations: {
[key: string] : SvgSpriteConfiguration
}
},
publicPath?: string,
}
@ -122,7 +123,7 @@ class SvgSpriteModule extends Module {
this.spriteSvg = await generateSpriteSvg(this.sprite);
this.spriteAssetName = "sprite-" + sha1(this.spriteSvg).substr(-20) + ".svg";
this.spriteAssetUrl = this.spriteAssetName;
this.spriteAssetUrl = (this.pluginConfig.publicPath || "") + this.spriteAssetName;
this.buildInfo.assets[this.spriteAssetName] = new RawSource(this.spriteSvg);