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

Generate a build manifest after the build #465

Merged
merged 9 commits into from
Sep 6, 2022
Merged

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Sep 6, 2022

About

Adds a silent (as it takes less than 1ms) post-build task to generate a simple JSON manifest of the MD5 hashes of the source file and the compiled HTML file. This can then be used to see if a page needs to be recompiled. MD5 was chosen for its speed and size and I think it's fine for this use since it's not used for anything cryptographic.

Usage scenarion

This can be used to determine if a compiled page is up to date with the source file by comparing if the input and output hashes match.

Configuration

The feature can be disabled in the configuration, as can output path. The defaults are seen below. They are not in the default config file, instead these are simply the fallback values internally.

// config/hyde.php
'generate_build_manifest' => true,
'build_manifest_path' => 'storage/framework/cache/build-manifest.json',

Example output

Here's the output for the base install, with formatted JSON

[
  {
    "page": "_pages/404.blade.php",
    "input_hash": "7b547049190f6f1ce70dceddab794326",
    "output_hash": "968d221de7edfb39bfdcb4ffda9dbb0e"
  },
  {
    "page": "_pages/index.blade.php",
    "input_hash": "05e29782724141145bc81bc7bba6024c",
    "output_hash": "6d92038753099941300ace4340e0cc97"
  }
]

@caendesilva caendesilva marked this pull request as ready for review September 6, 2022 09:55
@caendesilva caendesilva merged commit e9ecc57 into master Sep 6, 2022
@caendesilva caendesilva deleted the build-manifest branch September 6, 2022 09:56
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.

1 participant