-
Notifications
You must be signed in to change notification settings - Fork 115
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
Vite support #319
Comments
I did just discover a work-around: // Add a way of accessing the storage path
Vite::macro('assetSystemPath', function ($asset, $buildDirectory = null) {
$buildDirectory ??= $this->buildDirectory;
if ($this->isRunningHot()) {
return $this->hotAsset($asset);
}
$chunk = $this->chunk($this->manifest($buildDirectory), $asset);
return public_path($buildDirectory.'/'.$chunk['file']);
}); Config::set('css-inliner.css-files', [
Vite::assetSystemPath('my-styles.css'),
]); |
I faced the same situation. I am using laravel and vite. Can you tell me specifically what file should i put your settings in? |
I put it in my AppServiceProvider.php |
Thank you very much for your kind reply. |
I think my code might be bugged if running |
My problem was due to |
@Muffinman / @dvlpr91 is there a consensus? Will either of you two make a PR to add Vite support? |
I'm happy to make a PR to add I believe that allows for maximum flexibility. |
Hi! @Muffinman @DannyvdSluijs any news on this? I would love to help but I do not have enough experience on php I guess. Tomorrow I'll try the work around, but the config approach seems really nice taking into consideration that now laravel works with vite by default. Thanks for all the work you both have put on <3 |
I'm struggling to get this working properly with Vite assets.
This is because Vite does not currently expose a way of getting the filesystem path for a chunked asset.
It's possible to get an HTTP link to the asset below, but this will not work in a CI environment.
Vite has protected methods for returning the chunked filename, so it's not possible to call
Vite::chunk()
orVite::manifest()
directly.I can however, get the content of the files with
Vite::content('my-styles.css')
, so I would propose to add a new config optioncss-inliner.css-content
which would allow this to be used as below.Maybe I've missed something so let me know if there's another way of doing this.
The text was updated successfully, but these errors were encountered: