-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#111] Make styleId an optional string or function #110
[#111] Make styleId an optional string or function #110
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contribution!
After changes, please write some test for these changes
@marco-prontera I made the requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pedrosousa13, I talked to other contributors about what they think and we ended up not introducing this dependency but changing the styleId so that it is also possible to configure a callback which in this case will be called every time for every css file injection.
Can you change the code?
yeah totally. will make the change. |
@marco-prontera changes made, it now accepts a callback function. I also like this implementation :) |
* feat: allow for unique styleId when relativeCssInjection * fix: remove dash when there is no styleId * fix: only run changes if styleId exists * fix: move uuid to devDependencies + update README * fix: PR comments * fix: remove empty line * fix: remove empty line * fix: remove empty line * fix: remove unused duplicate test * refactor: styleId as callback function 3.3.0
Hi @pedrosousa13, I published the new version 3.3.0 |
We have a build that builds out css with
relativeCSSInjection
. I would like to have style tags with different id's as so not to clash.Using this with the SSR approach that I modified in my style injection function works really well https://github.com/egoist/style-inject/pull/28/files
Styles are loaded via SSR with different
id
attributes. This will only run ifstyleId
is specified.I'm adding this PR because I need the id to be the same for server + client so I need it at the vite level.
closes #111