-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat: add support for SSR style injection #126
Conversation
Found an issue where this change seems to fail on GitHub CI, will investigate and update when fixed |
Ok, I was using |
This applies to anyone using vue-style-loader with |
@KaelWD Yes it does 👍. I don't know if many people use Vue SSR + Vuetify without Nuxt? This fix would probably work for them too, but I haven't tested. |
@KaelWD Should be good to go, updated the documentation to be agnostic and just mention Vuetify as an example 👍 |
@KaelWD Could you please check this out? |
@Sshuichi If you want to try it in the meantime, feel free to use my branch instead of the npm package in your
|
@adrienbaron will give it a shot now. Thank you! |
@adrienbaron I tried your "vuetify-loader" implementation. But I am still facing FOUC. This is my nuxt.config.js import colors from 'vuetify/es5/util/colors' |
Hey @Dangelfidel ! There seem to be quite a few errors invalid syntax problems in your config, for example axios baseUrl doesn't have a value: Can you try editing your post and wrapping the config in triple backticks? This prevents Github messing with your formatting, like so:
|
@KaelWD I've rebased the branch, sorry took me a while to do that. Is there anything I can do to help get this merged? |
I've just gotta get off my ass and look at it. |
I was doing something else wrong, after removing node_modules and installing all the dependencies againit works. Many thanks for your great work @adrienbaron |
@KaelWD Rebased on |
btw it's easier to review changes with a linear history, otherwise I have to mess around with git to see what you've done since last time I looked at it. merges and a million commits are fine because it'll all be squashed in the end. |
@KaelWD Ah sorry about that, good shout, didn't think we would squash 👍 , will stop rewriting history now ^^" |
}) | ||
|
||
// This makes sure Vuetify main styles will be injected. | ||
// Using VApp as it's must be present for Vuetify to work, and it must only be there once. | ||
styles.get('VApp').add('src/styles/main.sass') |
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.
I'm not 100% sure about the style ordering here, but we can always come back and fix it if it turns out to be broken.
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.
Great job, thanks!
Fuck Yes!! |
@KaelWD is there a planning for when we might see a release containing this MR :)? Any help needed getting the release out? |
Very much looking forward to this release. |
I am also eagerly awaiting this release! Nice work. |
This PR adds support to inject Vuetify styles on SSR.
This fixes issues of styles not being included in the SSR response when using Nuxt + Vuetify:
This feature is based on an idea from @freddy38510. It works as follows:
.sass
files that are imported by each Vuetifygroup
(VTabs
,VCard
...)..sass
files theirgroup
depends on.vuetify-loader
adds the imports to Vuetify in a component, it also adds a conditional block that registers abeforeCreate
hook only on SSR (whenprocess.server
is true).beforeCreate
hook is called, itrequire
each.sass
file and calls__inject__
fromvue-style-loader
on them.A new option
registerStylesSSR
(set by default tofalse
) has been added to enable the behaviour.When it's set to
true
, you need to make sure to tellvue-style-loader
to enablemanualInject
.I've tested this with a relatively big project (https://www.clashofstats.com/) and it seems to work as expected 👍.
Feedback on this PR is very welcome!