Skip to content

Commit

Permalink
v1.1.1 - Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlemTuzlak committed May 14, 2024
1 parent a6fd307 commit 00a3e8c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-icons-spritesheet",
"version": "1.1.0",
"version": "1.1.1",
"description": "Vite plugin that generates a spritesheet out of your icons.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,14 @@ async function generateTypes({ names, outputPath }: { names: string[]; outputPat
* so only write if the content has changed
*/
async function writeIfChanged(filepath: string, newContent: string, message: string) {
const currentContent = await fs.readFile(filepath, "utf8");
if (currentContent !== newContent) {
try {
const currentContent = await fs.readFile(filepath, "utf8");
if (currentContent !== newContent) {
await fs.writeFile(filepath, newContent, "utf8");
console.log(message);
}
} catch (e) {
// File doesn't exist yet
await fs.writeFile(filepath, newContent, "utf8");
console.log(message);
}
Expand Down
2 changes: 1 addition & 1 deletion test-apps/remix-vite/icons/b.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test-apps/remix-vite/icons/c.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test-apps/remix-vite/icons/de.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 00a3e8c

Please sign in to comment.