I'm trying to set up Shake
for building a web application. At the end of my build process I would like to rename the resulting .js
and .css
files according to a content hash (for cache busting purposes).
This means of course that I do not know the final names of the files which look something like app-<hash>.min.js
.
Since the rule for building the final index.html
needs to know
about the names, I would need something like
"index.html" %> \out -> do
need [ "app-<hash>.min.js" ]
...
I've tried using a phony
action along the lines of
"index.html" %> \out -> do
need [ "revJsAndCssFiles" ]
...
phony "revJsAndCssFiles" $ do
... -- Hash and copy files to appropriate locations
This works but seems ugly since a phony
action isn't supposed to
produce a file.
What would be the best way to approach this problem?