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

Use md5 of compiled output content for filename #55

Open
kevin1 opened this issue Mar 29, 2024 · 1 comment
Open

Use md5 of compiled output content for filename #55

kevin1 opened this issue Mar 29, 2024 · 1 comment

Comments

@kevin1
Copy link

kevin1 commented Mar 29, 2024

I am wondering if jekyll-asset-pipeline should name files based on the hash of output content, rather than the hash of pipeline parameters. This would ensure that cachebusting always works even if the asset converter is not hermetic. (This cachebusting strategy is also used by webpack.)

Currently the hash is computed by this code:

Digest::MD5.hexdigest(YAML.safe_load(manifest).map! do |path|
"#{path}#{File.mtime(File.join(source, path)).to_i}"
end.join.concat(options.to_s))

A non-hermetic build example is compiling a SASS file that imports partials. If I have these two files:

colors.scss (not known to jekyll-asset-pipeline)

$my-color: blue;

main.scss (included in some pipeline)

@use "colors";
.foo {
  color: $my-color;
}

modifying colors.scss results in jekyll-assets-pipeline generating a file with the same hash, despite affecting the content of the output css.

I could prepare a PR if there is interest in changing the hash behavior. Thanks!

@janosrusiczki
Copy link
Collaborator

Please do prepare a PR. Despite appearances I'm still using and maintaining this project. 🙂

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

No branches or pull requests

2 participants