Fixed relative icon path loading for webpack with file paths (e.g. use with electron)
parent
0522e813b3
commit
3aede0bc1a
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "webpack-svg-sprite-generator",
|
"name": "webpack-svg-sprite-generator",
|
||||||
"version": "1.0.16",
|
"version": "1.0.17",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "plugin.js",
|
"main": "plugin.js",
|
||||||
"types": "ts/index.d.ts",
|
"types": "ts/index.d.ts",
|
||||||
|
|
|
@ -93,7 +93,9 @@ export async function generateSpriteCss(options: SpriteCssOptions, classPrefix:
|
||||||
let result = "";
|
let result = "";
|
||||||
result += `${options.selector}{`;
|
result += `${options.selector}{`;
|
||||||
result += `display:inline-block;`;
|
result += `display:inline-block;`;
|
||||||
result += `background:url("${publicUrl}") no-repeat;`;
|
/* doing a relative path here as well since WebPack may messes around here since the public path may start with / and if it's a file path / means the root... */
|
||||||
|
result += `background-image:url(".${publicUrl}"),url("${publicUrl}");`;
|
||||||
|
result += `background-repeat:no-repeat;`;
|
||||||
result += `background-size:${sprite.width * scaleX}${options.unit} ${sprite.height * scaleY}${options.unit};`;
|
result += `background-size:${sprite.width * scaleX}${options.unit} ${sprite.height * scaleY}${options.unit};`;
|
||||||
result += `height:${defaultHeight * scaleY}${options.unit};`;
|
result += `height:${defaultHeight * scaleY}${options.unit};`;
|
||||||
result += `width:${defaultWidth * scaleX}${options.unit}`;
|
result += `width:${defaultWidth * scaleX}${options.unit}`;
|
||||||
|
|
Loading…
Reference in New Issue