Skip to content

Commit 94733e4

Browse files
authored
hotfix: sprite build script fixed (#228)
1 parent 7ae1e9e commit 94733e4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/line/build-sprite.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const fs = require('fs-plus')
33
const glob = require('glob')
44
const path = require('path')
55
const sprites = svgstore()
6-
const svgFiles = path.join(process.cwd(), `svg/${process.env.STYLE}/*svg`)
6+
const svgFiles = path.join(process.cwd(), `svg/${process.env.STYLE}/*.svg`)
77

88
if (!fs.existsSync(path.join(process.cwd(), 'sprite'))) {
99
fs.mkdirSync(path.join(process.cwd(), 'sprite'))
@@ -20,9 +20,13 @@ glob(svgFiles, {}, function (er, files) {
2020
writtenFiles += 1
2121
})
2222

23-
fs.writeFile(path.join(process.cwd(), `sprite/${process.env.STYLE}/unicons.svg`), sprites, (err) => {
24-
if (err) console.log(err)
25-
})
23+
fs.writeFile(
24+
path.join(process.cwd(), `sprite/${process.env.STYLE}/unicons.svg`),
25+
sprites.toString(), // Ensure the sprites object is a string
26+
(err) => {
27+
if (err) console.log(err)
28+
},
29+
)
2630

2731
console.log(`Wrote Sprite for ${writtenFiles} files`)
2832
})

0 commit comments

Comments
 (0)