Skip to content

Commit

Permalink
hotfix: sprite build script fixed (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
imzedi authored Dec 6, 2024
1 parent 7ae1e9e commit 94733e4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/line/build-sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs-plus')
const glob = require('glob')
const path = require('path')
const sprites = svgstore()
const svgFiles = path.join(process.cwd(), `svg/${process.env.STYLE}/*svg`)
const svgFiles = path.join(process.cwd(), `svg/${process.env.STYLE}/*.svg`)

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

fs.writeFile(path.join(process.cwd(), `sprite/${process.env.STYLE}/unicons.svg`), sprites, (err) => {
if (err) console.log(err)
})
fs.writeFile(
path.join(process.cwd(), `sprite/${process.env.STYLE}/unicons.svg`),
sprites.toString(), // Ensure the sprites object is a string
(err) => {
if (err) console.log(err)
},
)

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

0 comments on commit 94733e4

Please sign in to comment.