Closed luoxiaozero closed 1 year ago
Is there any solution
Yeah there is a solution,
style!
and style_sheet!
macro generates css files that can be used to serve the css file separately from the server. style_str!
and style_sheet_str!
will return the style string instead of writing into separate css file.For your use case:
In your use case you want to export the components to other users. so you can't export separate css file for each component. I think you can use either style_str!
or styel_sheet_str!
. you can find code snippet in readme or detailed example in examples directory
I know the solution
It don't feel elegant
Ideally, the user would use that component and that component's css would be added to the main.css file, but this feels like a difficult feature to implement.
I am checking weather there is better way to do this. Please give me some time.
Edit: Can't we just attach global style element with some unique id. whenever user reuses the component we will just check whether style tag with that id exists or not, if not then add one style for that component.
ok
Since this problem is solvable using the above discussed approach I am closing this issue now.
I have an application that uses melt-ui (leptos UI library), and melt-ui uses stylers, but the css files generated by stylers are in the melt-ui directory. I tried to solve it, but it didn't work.