cryogen-project / cryogen

A simple static site generator written in Clojure
http://cryogenweb.org/
Eclipse Public License 1.0
1.09k stars 96 forks source link

[feature] unique files names #235

Open kwladyka opened 3 years ago

kwladyka commented 3 years ago

Unique files names for css / js etc.

For example in Hugo {{- $style := resources.Get "sass/main.scss" | toCSS | minify | fingerprint -}} make from scss file, but named main.min.e56b0f76143debd6df3cb44954ca9b65bf06439fee332c88f655980b7a15b5a7.css instead of "main.css". The hash is used.

This is expected result, but of course it need to be done in Selmer way.

Why? Issues with refresh files in web browser after update.

holyjak commented 2 years ago

Hi @kwladyka ! That sounds as a good idea. I guess somewhere around https://github.com/cryogen-project/cryogen-core/blob/8318bde771d39515b5f5a7f5af53ba5c55aeec35/src/cryogen_core/compiler.clj#L663 we could add code that computes the fingerprints, renames the files to include those, and creates a map original name -> fingerprinted name that can then be used from Selmer templates to get the correct file name.