Skip to content

Commit 00a3e8c

Browse files
committed
v1.1.1 - Fix
1 parent a6fd307 commit 00a3e8c

5 files changed

Lines changed: 12 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vite-plugin-icons-spritesheet",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Vite plugin that generates a spritesheet out of your icons.",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,14 @@ async function generateTypes({ names, outputPath }: { names: string[]; outputPat
123123
* so only write if the content has changed
124124
*/
125125
async function writeIfChanged(filepath: string, newContent: string, message: string) {
126-
const currentContent = await fs.readFile(filepath, "utf8");
127-
if (currentContent !== newContent) {
126+
try {
127+
const currentContent = await fs.readFile(filepath, "utf8");
128+
if (currentContent !== newContent) {
129+
await fs.writeFile(filepath, newContent, "utf8");
130+
console.log(message);
131+
}
132+
} catch (e) {
133+
// File doesn't exist yet
128134
await fs.writeFile(filepath, newContent, "utf8");
129135
console.log(message);
130136
}

test-apps/remix-vite/icons/b.svg

Lines changed: 1 addition & 1 deletion
Loading

test-apps/remix-vite/icons/c.svg

Lines changed: 1 addition & 1 deletion
Loading

test-apps/remix-vite/icons/de.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)