clubstudio / craft3-asset-rev

A Craft 3 plugin to help with cache busting
MIT License
7 stars 3 forks source link

Added $strict option and FilenameRev::existsInManifest() #3

Closed vicdelfant closed 7 years ago

vicdelfant commented 7 years ago

In our (probably not-so-common) case we also copy a couple of files to the asset output directory that we know will be there but aren't available from the manifest file. This caused an InvalidArgumentException in FilenameRev, with no option to get around this.

This PR introduces an optional $strict parameter to the {{ rev(...) }} Twig function that allows you to have FilenameRev fallback to appending a query string in case the file does not exist in the manifest. The README has been updated accordingly with an example.

timkelty commented 7 years ago

@scottwakefield would love to see this merged!

vicdelfant commented 7 years ago

Thanks to a PR from @timkelty the $strict parameter is now even more flexible, allowing non-existing files to pass through if $strict = false as well.

scottwakefield commented 7 years ago

Hey @vicdelfant and @timkelty,

Thank you for the contributions guys!

Happy to merge this in if you could make a couple of updates for me :)

Would it be possible for you to remove - 5.6 from .travis.yml so that the CI passes – I should have removed this myself as Craft 3 requires 7.0+ anyway.

Also, can you make the necessary updates to get the StyleCI check to pass?

That would save me a bunch of time in pulling the PR down just to tweak those bits. Hope you don't mind.

vicdelfant commented 7 years ago

@scottwakefield no problem, it took a couple of commits but here we go! :)

scottwakefield commented 7 years ago

Nice work @vicdelfant – appreciate it!

timkelty commented 7 years ago

@scottwakefield can you bump the version and push a new tag so this is installable from packagist?

scottwakefield commented 7 years ago

@timkelty All sorted now! Sorry for the delay, I ran out of time yesterday.

Hope that's all good now. Let me know if not :)

Thanks again for your work on this!

timkelty commented 7 years ago

1.1.0 working great, thanks!