Skip to content
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

[9.x] Adding option for custom manifest filename on Vite Facade #45007

Merged
merged 2 commits into from Nov 21, 2022

Conversation

ngstwr
Copy link
Contributor

@ngstwr ngstwr commented Nov 18, 2022

Option added to pass the name of the manifest file to be used while using the Vite Facade.

Before:
Vite::asset(['resources/sass/app.scss'], 'dist')

Now:
Vite::asset(['resources/sass/app.scss'], 'dist', 'app-manifest.json')

@ngstwr
Copy link
Contributor Author

ngstwr commented Nov 18, 2022

In response to this issue: #45002

@taylorotwell taylorotwell marked this pull request as draft November 18, 2022 15:12
@timacdonald timacdonald changed the title Adding option for custom manifest filename on Vite Facade [9.x] Adding option for custom manifest filename on Vite Facade Nov 20, 2022
@timacdonald
Copy link
Member

timacdonald commented Nov 21, 2022

Hey @ngstwr,

Thanks for the PR. I've tweaked the implementation slightly. In a global service provider, route based middleware, or inline in a view, you may now specify the manifest file with the following API...

Service provider / middleware example...

use Illuminate\Support\Facades\Vite;

Vite::useManifestFilename('custom-manifest.json');
{{-- Uses the custom manifest filename --}}

@vite(['resources/js/app.js'])

Inline example...

{{ Vite::useManifestFilename('custom-manifest.json')->withEntryPoints(['resources/js/app.js']) }}

Documentation PR: laravel/docs#8352

@timacdonald timacdonald marked this pull request as ready for review November 21, 2022 00:16
@ngstwr
Copy link
Contributor Author

ngstwr commented Nov 21, 2022

@timacdonald This is indeed a better way!

Somewhat related to this PR:

Shouldn't we do this with the 'buildDirectory' parameter also?

If we can use the new API (useManifestFilename) via a global service provider or route-based middleware, it doesn't make sense to pass the custom build directory path as a parameter with every @Vite() call.

Let me know what you think!

@timacdonald
Copy link
Member

@ngstwr that is already available with Vite::useBuildDirectory($path).

See: https://laravel.com/docs/9.x/vite#advanced-customization

@ngstwr
Copy link
Contributor Author

ngstwr commented Nov 21, 2022

Oh, thanks, somehow I missed that section on the documentation!

Will wait for this PR to be merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants