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

[5.x] feature: this adds the vite integrity plugin to support assetsAreCurrent check #1415

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

mmachatschek
Copy link
Contributor

This adds the manifest integrity plugin for vite to support checks if the user published the current version of the horizon assets.

Comment on lines +3 to +13
use Illuminate\Foundation\Vite as ViteFoundation;

$viteDataSchemeLight = new ViteFoundation();
$viteDataSchemeLight->useStyleTagAttributes([
'data-scheme' => 'light',
]);

$viteDataSchemeDark = new ViteFoundation();
$viteDataSchemeDark->useStyleTagAttributes([
'data-scheme' => 'dark',
]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if there is a better solution to this please tell me. currently its fairly hard (impossible) to add these kind of style tag attributes with the @Vite blade directive

…ent check

fix schema -> scheme

compile assets
@driesvints
Copy link
Member

@mmachatschek what would they see if the assets aren't up to date? I also thought we already had a check for this 🤔

@mmachatschek
Copy link
Contributor Author

@driesvints there is a file compare check here

return File::get($publishedPath) === File::get(__DIR__.'/../public/build/manifest.json');
that checks if the manifest.json in the published folder is the same as the manifest.json from the package.

with laravel mix we used versioning that added a hash ?id= for invalidating

"/app.js": "/app.js?id=4999da9248177ed487693daec2a7d3fe",
the built files.

the integrity package readds this missing feature after my change from mix to vite

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