Skip to content

Conversation

@AlemTuzlak
Copy link
Contributor

@AlemTuzlak AlemTuzlak commented Apr 4, 2025

Test Plan

  • Check there are no type-errors
  • all the icons work as expected
  • behavior is same as before
  • adding/editting/removing icons produces new spritesheet automatically
  • Check if icons work when deployed

Checklist

  • Tests updated
  • Docs updated

Screenshots

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'm a fan. Thanks a lot!

@kentcdodds kentcdodds merged commit 25cab41 into epicweb-dev:main Apr 4, 2025
5 checks passed
@ryanwoodcox
Copy link
Contributor

@AlemTuzlak this is awesome. Should the https://github.com/epicweb-dev/epic-stack/blob/main/other/svg-icons/README.md also be updated?

@AlemTuzlak
Copy link
Contributor Author

Thank you, it probably should 😅

@ryanwoodcox
Copy link
Contributor

Thank you, it probably should 😅

I'd suggest something like:

# Icons

These icons were downloaded from https://icons.radix-ui.com/ which is licensed under MIT:
https://github.com/radix-ui/icons/blob/master/LICENSE

It's important that you only add icons to this directory that the application actually needs as the
`vite-plugin-icons-spritesheet` plugin is configured to generate a spritesheet with icons from this
directory. The plugin re-runs on every edit/delete/add to this directory.

@kentcdodds
Copy link
Member

Fixed. Thanks!

@damiensedgwick
Copy link
Contributor

I opened an issue thinking that my app was broken and Kent kindly pointed me to here. When I try and install a new icon I get hit with an error npm error Missing script: "build:icons"

I've used npx epicli update to apply the latest patches to my project but it seems like new icons cannot be added, unless I am missing something?

@AlemTuzlak
Copy link
Contributor Author

@damiensedgwick Seems to be related to sly.json config, it tries to run the build icons script everytime you pull in a new icon, if you change the script in /other/sly/sly.json to:

{
	"$schema": "https://sly-cli.fly.dev/registry/config.json",
	"libraries": [
		{
			"name": "@radix-ui/icons",
			"directory": "./other/svg-icons",
			"postinstall": [],
			"transformers": [
				"transform-icon.ts"
			]
		}
	]
}

does it work?

@damiensedgwick
Copy link
Contributor

damiensedgwick commented Apr 7, 2025

that did the trick, thank you @AlemTuzlak

edit: maybe not, my icons are not showing:

no-icon

@AlemTuzlak
Copy link
Contributor Author

AlemTuzlak commented Apr 7, 2025

@damiensedgwick are you running the dev server? or did you run npm run build? . Feel free to add me on discord so we can figure it out, I've used sly to pull in icons with this plugin so it definitely should work

Edit:
Tried pulling in new icons from radix and it worked fine

@damiensedgwick
Copy link
Contributor

@damiensedgwick are you running the dev server? or did you run npm run build? I guess to align it with the old approach more it would be more correct to run npm run build after pulling it in. Feel free to add me on discord so we cna figure it out, I've used sly to pull in icons with this plugin so it definitely should work

I've ran both the dev server and built it, as well as validated and it did work for the gear but for some reason something isn't quite lined up now when I tried adding two more icons.

I will add you on Discord, cheers!

@damiensedgwick
Copy link
Contributor

@damiensedgwick are you running the dev server? or did you run npm run build? I guess to align it with the old approach more it would be more correct to run npm run build after pulling it in. Feel free to add me on discord so we cna figure it out, I've used sly to pull in icons with this plugin so it definitely should work

I've ran both the dev server and built it, as well as validated and it did work for the gear but for some reason something isn't quite lined up now when I tried adding two more icons.

I will add you on Discord, cheers!

Tried installing icons whilst the server was running and it worked as expected. Then tried stopping the server and installing, and it also worked as expected so I am not really sure what was happening but all is right with the icons now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants