diff options
-rw-r--r-- | build/build-svgs.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/build/build-svgs.js b/build/build-svgs.js index 33ae82ed3..f9a00e52c 100644 --- a/build/build-svgs.js +++ b/build/build-svgs.js @@ -13,9 +13,6 @@ const iconsDir = path.join(__dirname, '../icons/') const svgAttributes = { class: '', - width: '1em', - height: '1em', - viewBox: '0 0 16 16', fill: 'currentColor', xmlns: 'http://www.w3.org/2000/svg' } @@ -53,6 +50,13 @@ const processFile = (file, config) => new Promise((resolve, reject) => { $(svg).attr(attr, val) } + const dimensions = $(svg).attr('viewBox').split(' ') + const svgWidth = dimensions[2] / 16 + const svgHeight = dimensions[3] / 16 + + $(svg).attr('width', `${svgWidth}em`) + $(svg).attr('height', `${svgHeight}em`) + $(svg).attr('class', `bi bi-${path.basename(file, '.svg')}`) fs.writeFile(file, $(svg), 'utf8') |