3
3
The Epic Stack uses SVG sprites for
4
4
[ optimal icon performance] ( https://benadam.me/thoughts/react-svg-sprites/ ) .
5
5
You'll find raw SVGs in the ` ./other/svg-icons ` directory. These are then
6
- compiled into a sprite using the ` npm run build:icons ` script which generates
7
- the ` icon.svg ` file and an ` icons.json ` manifest file that allows Typescript to
8
- pick up the names of the icons.
6
+ compiled into a sprite using the
7
+ [ ` vite-plugin-icons-spritesheet ` ] ( https://github.com/jacobparis-insiders/vite-plugin-icons-spritesheet )
8
+ plugin which generates the ` app/components/ui/icons/sprite.svg ` file and the
9
+ accompanying ` types.ts ` file that allows Typescript to pick up the names of the
10
+ icons.
9
11
10
12
You can use [ Sly] ( https://github.com/jacobparis-insiders/sly/tree/main/cli ) to
11
13
add new icons from the command line.
@@ -21,20 +23,16 @@ icons available in the `@radix-ui/icons` collection and let you select the ones
21
23
you want to add.
22
24
23
25
Sly has been configured in the Epic Stack to automatically add the icons to the
24
- ` ./other/svg-icons ` directory and to run the ` npm run build:icons ` script
25
- automatically, so there are no extra steps to take. You can see the
26
- configuration in the ` ./other/sly/sly.json ` file.
26
+ ` ./other/svg-icons ` directory, so there are no extra steps to take. You can see
27
+ the configuration in the ` ./other/sly/sly.json ` file.
27
28
28
29
The SVGs used by default in the Epic Stack come from
29
30
[ icons.radix-ui.com] ( https://icons.radix-ui.com/ ) . You can download additional
30
31
SVG icons from there, or provide your own. Once you've added new files in the
31
- directory, run ` npm run build:icons ` and you can then use the ` Icon ` component
32
- to render it. The ` icon ` prop is the name of the file without the ` .svg `
33
- extension. We recommend using ` kebab-case ` filenames rather than ` PascalCase ` to
34
- avoid casing issues with different operating systems.
35
-
36
- Note that the ` ./other/build-icons.ts ` file automatically removes ` width ` and
37
- ` height ` props from your SVGs to ensure they scale properly.
32
+ directory, run ` npm run build ` and you can then use the ` Icon ` component to
33
+ render it. The ` icon ` prop is the name of the file without the ` .svg ` extension.
34
+ We recommend using ` kebab-case ` filenames rather than ` PascalCase ` to avoid
35
+ casing issues with different operating systems.
38
36
39
37
By default, all the icons will have a height and width of ` 1em ` so they should
40
38
match the font-size of the text they're next to. You can also customize the size
0 commit comments