Skip to content

Commit 7823a0c

Browse files
committed
Fix: spriteRef when image is undefined
1 parent 5a876c7 commit 7823a0c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,11 @@ function updateReferences(images, opts, sprites, css) {
449449
if (isToken(comment)) {
450450
image = lodash.find(images, { url: comment.text });
451451

452-
// Fix path to the sprite
453-
image.spriteRef = path.relative(path.dirname(css.source.input.file), image.spritePath);
454-
image.spriteRef = path.posix.normalize(image.spriteRef);
455-
456452
if (image) {
453+
// Fix path to the sprite
454+
image.spriteRef = path.relative(path.dirname(css.source.input.file), image.spritePath);
455+
image.spriteRef = image.spriteRef.replace(path.sep, '/', 'g');
456+
457457
backgroundImage = postcss.decl({
458458
prop: 'background-image',
459459
value: getBackgroundImageUrl(image)

0 commit comments

Comments
 (0)