-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
No way to combine craft.vite.asset
with craft.vite.inline
in Docker
#22
Comments
Similar to: nystudio107/craft-vite#72 |
So interestingly, at least in theory, the logic is already in there to do this: public function asset(string $path, bool $public = false): string
{
if ($this->devServerRunning()) {
return $this->devServerAsset($path);
}
if ($public) {
return $this->publicAsset($path);
}
return $this->manifestAsset($path);
} ref: https://github.com/nystudio107/craft-plugin-vite/blob/develop-v4/src/services/ViteService.php#L310 Why it isn't working as expected, I'm not sure. |
Okay I misunderstood the issue on the initial read. The actual issue is that PHP needs to pull from the internal Docker network to do what you want. |
Added in: bf8df08 & ce9424a & ed4c7d0 Craft CMS 3: You can try it now by setting your semver in your "nystudio107/craft-plugin-vite": "dev-develop as 1.0.33”, Then do a ….. Craft CMS 4: You can try it now by setting your semver in your "nystudio107/craft-plugin-vite": "dev-develop-v4 as 4.0.9”, Then do a ….. Craft CMS 5: You can try it now by setting your semver in your "nystudio107/craft-plugin-vite": "dev-develop-v5 as 5.0.0-beta.2”, Then do a |
@khalwat correct - but only when using |
Right. Try the changes I pushed @boboldehampsink |
Works, thanks! |
I'm using Docker, where I have a web container and a separate vite container.
{% set logoPath = craft.vite.asset('/src/assets/img/svg/brand-logo.svg') %}
returnshttp://localhost:3000/src/assets/img/svg/brand-logo.svg
, which is fine for public use.But when I want to do this:
{{ craft.vite.inline(logoPath) }}
It fails because we're still in Docker, and it doesn't know localhost:3000 - it needs vite:3000 (the internal dev server url als you call it)
My workaround for now is:
{{ craft.vite.inline(logoPath|replace('localhost', 'vite')) }}
But it would be nice to have an option for example on
craft.vite.asset
to use the internal dev server urlThe text was updated successfully, but these errors were encountered: