Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/icons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2020-12-29 23:08:26 +0300
committerGitHub <noreply@github.com>2020-12-29 23:08:26 +0300
commita7b4834b8abc8105bdad3f7c56c5369f5d35cdb2 (patch)
tree8cbc0a7ac95f3377e9c269ce4af00ed23699bfa2 /build
parent62dfda734c37b8027cb948a2011399fe1a11b723 (diff)
Update cheerio to v1.0.0-rc.5. (#575)
Adapt build/build-svgs.js to this version. Make sure we are parsing the nodes as XML. Also replace CR/CRLF with LF in the output SVG.
Diffstat (limited to 'build')
-rw-r--r--build/build-svgs.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/build/build-svgs.js b/build/build-svgs.js
index 545e97a91..766ff408f 100644
--- a/build/build-svgs.js
+++ b/build/build-svgs.js
@@ -47,7 +47,11 @@ const processFile = (file, config) => {
svgo.optimize(data)
.then(result => {
- const $ = cheerio.load(result.data)
+ const $ = cheerio.load(result.data, {
+ xml: {
+ xmlMode: true
+ }
+ })
const $svgElement = $('svg')
// We keep all SVG contents apart from the `<svg>` element.
@@ -61,7 +65,7 @@ const processFile = (file, config) => {
$svgElement.attr(attribute, attribute === 'class' ? `bi bi-${basename}` : value)
}
- fs.writeFile(filepath, $svgElement.toString(), 'utf8')
+ fs.writeFile(filepath, $svgElement.toString().replace(/\r\n?/g, '\n'), 'utf8')
.then(() => {
if (VERBOSE) {
console.log(`- ${basename}`)