bvdputte / kirby-fingerprint

Cache-busting utility to fingerprint assets (JS/CSS) in Kirby CMS
MIT License
16 stars 3 forks source link

Make @auto assets work #5

Closed bezin closed 5 years ago

bezin commented 5 years ago

Hi there,

first of all thanks a lot for your plugin. It is as as simply as the cachebuster plugin for Kirby 2 and that is what I like about it :-)

I would like to use it in an upcoming project, however it was missing the support for @auto templates. As long as getkirby/kirby::1608 is not fixed, this PR makes @auto assets work.

Please be aware, that the changes made to Fingerprint.php are necessary nonetheless, even when 1608 is fixed: In your addHash method you are currently working with paths. However, the css and js helpers works with absolute urls, too. In this case https://github.com/bvdputte/kirby-fingerprint/compare/master...presprog:feature/@auto-assets#diff-de63c4a79f953aee3228edcf6479c9ccR15 will always return false. The additional check for an absolute url fixes that.

Cheerio

bezin commented 5 years ago

Nevermind, there is another issue which cannot be resolved without 1608 being fixed:

The CSS (and JS) helper always expect a path from the css component. It does not handle a null value or alike to determine that there is no file.

Right now, this PR would always include an empty link <link href="//127.0.0.1:8080" rel="stylesheet">

bvdputte commented 5 years ago

Thx Benedict 🙌🏻