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] Add manifestHash function to Illuminate\Foundation\Vite #44136

Merged
merged 3 commits into from
Sep 15, 2022
Merged

[9.x] Add manifestHash function to Illuminate\Foundation\Vite #44136

merged 3 commits into from
Sep 15, 2022

Conversation

innocenzi
Copy link
Contributor

This PR adds a hash method to Illuminate\Foundation\Vite that returns a unique hash if the manifest exists. This is useful to invalidate assets, for instance using Inertia:

<?php

// ...

class HandleInertiaRequests extends Middleware
{

    // ...

    public function version(Request $request): ?string
    {
        return Vite::hash();
    }
}

@innocenzi innocenzi changed the title feat: add hash function to Vite [9.x] Add hash function to Illuminate\Foundation\Vite Sep 14, 2022
Copy link
Member

@timacdonald timacdonald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful for any long-lived front-end.

Thought: Wonder if Vite::manifestHash() might indicate better what it is doing?

@innocenzi
Copy link
Contributor Author

@timacdonald Fine by me, I updated the PR 👍

@innocenzi innocenzi changed the title [9.x] Add hash function to Illuminate\Foundation\Vite [9.x] Add manifestHash function to Illuminate\Foundation\Vite Sep 15, 2022
@taylorotwell taylorotwell merged commit 74cad57 into laravel:9.x Sep 15, 2022
@innocenzi innocenzi deleted the feat/vite-hash branch September 15, 2022 19:37
@timacdonald
Copy link
Member

Thank you Enzo!

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.

3 participants