-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Include a 'devServerIsRunning' variable #10
Labels
enhancement
New feature or request
Comments
Good idea, I'll roll that in. |
khalwat
added a commit
to nystudio107/craft-plugin-vite
that referenced
this issue
Jul 15, 2021
…ine if the Vite dev server is running or not from your Twig templates (nystudio107/craft-vite#10) Signed-off-by: Andrew Welch <[email protected]>
khalwat
added a commit
that referenced
this issue
Jul 15, 2021
…ine if the Vite dev server is running or not from your Twig templates (#10) Signed-off-by: Andrew Welch <[email protected]>
Implemented in 1.0.13 -> https://github.com/nystudio107/craft-vite/releases/tag/1.0.13 |
@stenvdb I think we have a better solution as detailed here: Issue ref: vitejs/vite#2394 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As stated in your blog post, there is an issue with static assets being referenced in CSS for example (https://nystudio107.com/blog/using-vite-js-next-generation-frontend-tooling-with-craft-cms#vite-processed-assets). A workaround could be to include a
<base>
tag to manually set the base url for all relative links. The tag should be set to the dev server if it is running or thePRIMARY_SITE_URL
if it is not.Since this could cause other issues, the best way would be to do this manually in your templates. So what would help is a way to check if the vite dev server is running in your templates. Something like:
If you would made sure that you're using absolute paths for all assets or urls in a site, then this would fix relative paths in CSS or JS.
The text was updated successfully, but these errors were encountered: