From 6a79237b51edd068bbec308e9151d433d8e3dcbb Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 16 Mar 2021 20:38:21 +0100 Subject: [PATCH] Added the ability to define a public path --- package.json | 2 +- plugin/plugin.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b0d6028..70724bc 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/plugin/plugin.ts b/plugin/plugin.ts index 7e84001..5ba5d2f 100644 --- a/plugin/plugin.ts +++ b/plugin/plugin.ts @@ -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);