-
<.button> in a heex template looks a lot different than < button> in a .svelte file. What would be a good way to sync up the styles between Svelte and Phoenix components? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
So If you want to have parity between the 2, you'd need to create a Svelte component I can't see an immediate easy way of syncing up the styles. One approach you can take is removing the tailwind styles from the Another approach is to just copy each core_component and remake it in Svelte. But then you'd have the same style specified in 2 places, which is not always ideal. Another approach might be to make this automated with a command, although I'm not sure that's even possible. If you decide to go with the approach of remaking every component inside Svelte I'd be happy to add it to the live_svelte core, and maintain it so it's in sync. This way users can just do something like |
Beta Was this translation helpful? Give feedback.
So
<.button>
uses a Phoenix component defined incore_components.ex
. In svelte you'd use<button>
which is the HTML tag for a button.If you want to have parity between the 2, you'd need to create a Svelte component
<Button>
that works in the exact same way as the Phoenix component.I can't see an immediate easy way of syncing up the styles.
One approach you can take is removing the tailwind styles from the
core_components.ex
and defining a global.button
style which you then can apply on both the Svelte button and the Phoenix button. Then whenever you have a style change you only need to apply it in the.button
class.Another approach is to just copy each core_component and remake it in …