Skip to content

Commit 6afd931

Browse files
committed
feat: Add vite-plugin-icons-spritesheet instead of the custom build script
1 parent e59a9c9 commit 6afd931

File tree

5 files changed

+33
-163
lines changed

5 files changed

+33
-163
lines changed

other/build-icons.ts

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

package-lock.json

Lines changed: 21 additions & 0 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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
},
1212
"scripts": {
1313
"build": "run-s build:*",
14-
"build:icons": "tsx ./other/build-icons.ts",
1514
"build:remix": "react-router build",
1615
"build:server": "tsx ./other/build-server.ts",
17-
"predev": "npm run build:icons --silent",
1816
"dev": "cross-env NODE_ENV=development MOCKS=true node ./server/dev-server.js",
1917
"dev:no-mocks": "cross-env NODE_ENV=development node ./server/dev-server.js",
2018
"format": "prettier --write .",
@@ -147,7 +145,6 @@
147145
"fs-extra": "^11.3.0",
148146
"jsdom": "^25.0.1",
149147
"msw": "^2.7.3",
150-
"node-html-parser": "^7.0.1",
151148
"npm-run-all": "^4.1.5",
152149
"prettier": "^3.5.3",
153150
"prettier-plugin-sql": "^0.18.1",
@@ -157,6 +154,7 @@
157154
"tw-animate-css": "^1.2.4",
158155
"typescript": "^5.8.2",
159156
"vite": "^6.2.2",
157+
"vite-plugin-icons-spritesheet": "^3.0.1",
160158
"vitest": "^3.0.9"
161159
},
162160
"engines": {
@@ -166,4 +164,4 @@
166164
"seed": "tsx prisma/seed.ts"
167165
},
168166
"prettier": "@epic-web/config/prettier"
169-
}
167+
}

tsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
"paths": {
99
"#app/*": ["./app/*"],
1010
"#tests/*": ["./tests/*"],
11-
"@/icon-name": [
12-
"./app/components/ui/icons/name.d.ts",
13-
"./types/icon-name.d.ts"
14-
]
11+
"@/icon-name": ["./app/components/ui/icons/types.ts", "./types/types.ts"]
1512
}
1613
}
1714
}

vite.config.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { reactRouter } from '@react-router/dev/vite'
22
import {
3-
sentryReactRouter,
43
type SentryReactRouterBuildOptions,
4+
sentryReactRouter,
55
} from '@sentry/react-router'
66
import tailwindcss from '@tailwindcss/vite'
77
import { defineConfig } from 'vite'
88
import { envOnlyMacros } from 'vite-env-only'
9+
import { iconsSpritesheet } from 'vite-plugin-icons-spritesheet'
910

1011
const MODE = process.env.NODE_ENV
1112

@@ -20,7 +21,6 @@ export default defineConfig((config) => ({
2021

2122
assetsInlineLimit: (source: string) => {
2223
if (
23-
source.endsWith('sprite.svg') ||
2424
source.endsWith('favicon.svg') ||
2525
source.endsWith('apple-touch-icon.png')
2626
) {
@@ -39,6 +39,13 @@ export default defineConfig((config) => ({
3939
plugins: [
4040
envOnlyMacros(),
4141
tailwindcss(),
42+
iconsSpritesheet({
43+
inputDir: './other/svg-icons',
44+
outputDir: './app/components/ui/icons',
45+
fileName: 'sprite.svg',
46+
withTypes: true,
47+
iconNameTransformer: (name) => name,
48+
}),
4249
// it would be really nice to have this enabled in tests, but we'll have to
4350
// wait until https://github.com/remix-run/remix/issues/9871 is fixed
4451
MODE === 'test' ? null : reactRouter(),

0 commit comments

Comments
 (0)