Skip to content

Commit 21955a6

Browse files
alem tuzlakalem tuzlak
authored andcommitted
Removed custom icon script in favor of a vite plugin
1 parent 2e255e2 commit 21955a6

6 files changed

Lines changed: 53 additions & 110 deletions

File tree

app/library/icon/icons/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
// This file is generated by npm run build:icons
1+
// This file is generated by icon spritesheet generator
22

3-
export type IconName = "ShoppingCart";
3+
export type IconName =
4+
| "ShoppingCart"
45

5-
export const iconNames = ["ShoppingCart"] as const;
6+
export const iconNames = [
7+
"ShoppingCart",
8+
] as const

package-lock.json

Lines changed: 36 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"scripts": {
88
"execute": "node --no-warnings --experimental-specifier-resolution=node --loader ./scripts/loader.js",
99
"script": "npm run execute scripts/setup.ts",
10-
"icons": "npm run script scripts/icons.ts",
1110
"cleanup": "npm run script scripts/cleanup.ts",
11+
"postinstall": "npm run cleanup",
1212
"build": "remix vite:build",
1313
"dev": "remix vite:dev",
1414
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
@@ -73,6 +73,7 @@
7373
"tsconfig-paths": "^4.2.0",
7474
"typescript": "^5.4.3",
7575
"vite": "^5.2.8",
76+
"vite-plugin-icons-spritesheet": "^1.2.0",
7677
"vite-tsconfig-paths": "^4.3.2",
7778
"vitest": "^1.4.0"
7879
},

scripts/cleanup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const removeTheCleanupFromPackageJsonAndScripts = async () => {
2626
);
2727

2828
delete packageJson.scripts.cleanup;
29+
delete packageJson.scripts.postinstall;
30+
2931
await fs.writeFile(
3032
"package.json",
3133
JSON.stringify(packageJson, null, 2),

scripts/icons.ts

Lines changed: 0 additions & 103 deletions
This file was deleted.

vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig } from "vite";
33
import tsconfigPaths from "vite-tsconfig-paths";
44
import { remixDevTools } from "remix-development-tools";
55
import { routes } from "./remix/config";
6+
import { iconsSpritesheet } from "vite-plugin-icons-spritesheet";
67

78
export default defineConfig({
89
plugins: [
@@ -11,6 +12,12 @@ export default defineConfig({
1112
unstable_console: true,
1213
}),
1314
remix({ routes }),
15+
iconsSpritesheet({
16+
inputDir: "./resources/icons",
17+
outputDir: "./app/library/icon/icons",
18+
withTypes: true,
19+
fileName: "icon.svg",
20+
}),
1421
tsconfigPaths(),
1522
],
1623
ssr: {

0 commit comments

Comments
 (0)