Added the ability to define a public path
parent
b2408a9b2d
commit
6a79237b51
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "webpack-svg-sprite-generator",
|
"name": "webpack-svg-sprite-generator",
|
||||||
"version": "5.0.1",
|
"version": "5.0.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "plugin.js",
|
"main": "plugin.js",
|
||||||
"types": "ts/index.d.ts",
|
"types": "ts/index.d.ts",
|
||||||
|
|
|
@ -20,7 +20,8 @@ export interface Options {
|
||||||
dtsOutputFolder: string,
|
dtsOutputFolder: string,
|
||||||
configurations: {
|
configurations: {
|
||||||
[key: string] : SvgSpriteConfiguration
|
[key: string] : SvgSpriteConfiguration
|
||||||
}
|
},
|
||||||
|
publicPath?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ class SvgSpriteModule extends Module {
|
||||||
|
|
||||||
this.spriteSvg = await generateSpriteSvg(this.sprite);
|
this.spriteSvg = await generateSpriteSvg(this.sprite);
|
||||||
this.spriteAssetName = "sprite-" + sha1(this.spriteSvg).substr(-20) + ".svg";
|
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);
|
this.buildInfo.assets[this.spriteAssetName] = new RawSource(this.spriteSvg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue