Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Mar 12, 2022
1 parent b57ecbf commit ac15fc7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/svg-sprite/utils/calculate-svg-dimensions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const { Resvg } = require('@resvg/resvg-js');
const imageSize = require('image-size');
const { imageSize } = require('image-size');

/**
* @typedef {object} Dimension
Expand All @@ -24,13 +24,9 @@ function calculateSvgDimensions(svg) {
}
});
const pngData = resvg.render();
const { width, height } = imageSize(pngData);

const dimensions = imageSize.imageSize(pngData);

return {
height: dimensions.height,
width: dimensions.width
};
return { width, height };
} catch (error) {
const e = new Error(error);
e.name = 'DimensionsCalculationError';
Expand Down

0 comments on commit ac15fc7

Please sign in to comment.