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

Allow referring to compiled content in rule #44

Open
denisdefreyne opened this issue Jul 23, 2018 · 1 comment
Open

Allow referring to compiled content in rule #44

denisdefreyne opened this issue Jul 23, 2018 · 1 comment
Labels

Comments

@denisdefreyne
Copy link
Member

For cache-busting purposes, it would be useful to write a file to a path that depends on the compiled content:

compile '/style/screen.css' do
  hash = Digest::SHA1.hexdigest(item_rep.compiled_content)
  write "/style/screen-#{hash}.css"
end

This is not currently possible, because there is a chicken-and-egg problem (a rule defines how to compile an item rep, but the rule cannot be applied until after the item rep is compiled) which might only be solvable by putting severe restrictions on where the compiled content can be accessed — ideally, only in #write in a compilation rule.

@denisdefreyne
Copy link
Member Author

Idea from @Fjan:

Perhaps implement it by creating an item_rep.fingerprinted_name so nanoc can keep control where it's being used and prevent people from using compiled content in other places.

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

No branches or pull requests

1 participant