-
-
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
public assets v4 #9
Conversation
Is this something that isn't working correctly currently? Shouldn't anything in |
If i have assets that are referenced in the css or js then it all works fine. Its when i want to use a public asset, the dev server is working but not when its been built as the asset is not in the manifest. This tweak doesn't use the manifest and return the path prefixed with the destination folder |
Ah I see. They are solving this in Vite 3 via this PR: vitejs/vite#6649 (comment) Are you able to wait until then, or...? |
Yes i could wait until then (although don't know when "then" is?) I'm assuming that PR is about being able to add assets to the manifest (outside of js/css), but wouldn't we still have the same issue with public assets (that we don't want hashed) not being able to correctly reference? |
Ah yes, you're right on both fronts. How about this for an idea -- since they have hard-coded |
"public" can be configured using the "publicDir" property, I have it set to "/src/assets" instead of a flag, we could add another function: craft.vite.publicAsset('url'). I thought a flag might be cleaner. |
Roger that. Will merge it in and update the docs -- I'm assuming this works with the |
yes it works with both. |
Thx for the PR! |
adds a boolean as a second param to the
craft.vite.asset('url', true)
so that assets in the vite public folder can be referenced correctly.