mirror of
https://github.com/feathericons/feather.git
synced 2023-08-10 21:13:24 +03:00
fix: Remove unecessary whitespace from SVG contents
```js /* BEFORE */ { circle: "\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n" } /* AFTER */ { circle: "<circle cx=\"12\" cy=\"12\" r=\"10\"></circle>" } ```
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import path from 'path';
|
||||
import cheerio from 'cheerio';
|
||||
import { minify } from 'html-minifier';
|
||||
|
||||
/**
|
||||
* Build an object in the format: `{ <name>: <contents> }`.
|
||||
@@ -28,7 +29,7 @@ function buildIconsObject(svgFiles, getSvg) {
|
||||
*/
|
||||
function getSvgContents(svg) {
|
||||
const $ = cheerio.load(svg);
|
||||
return $('svg').html();
|
||||
return minify($('svg').html(), { collapseWhitespace: true });
|
||||
}
|
||||
|
||||
export default buildIconsObject;
|
||||
|
Reference in New Issue
Block a user