scyllagroup / UmbracoFlare

This project aims to provide a basic level of service integration between Cloudflare and the open-source ASP.NET CMS Umbraco.
https://www.umbracoflare.com/
Creative Commons Attribution Share Alike 4.0 International
18 stars 3 forks source link

Utilize FileService to purge on update of Stylesheet and Scripts #12

Closed cyberknet closed 5 years ago

cyberknet commented 6 years ago

Is it possible to utilize FileService events? link: https://our.umbraco.com/documentation/reference/events/fileservice-events

The idea is to try to catch Stylesheet and Script files being saved, and purge them from CloudFlare cache when they are updated the same way the Media and Content are being done today.

jmcaveney commented 6 years ago

That's a possibility, yes. We included a static file picker in the dashboard for this purpose, but it would be nice to automatically save the edited scripts, etc.

We don't typically allow script or css editing in our sites (we build them via webpack to deploy) so it never occurred to us.

cyberknet commented 6 years ago

I am working on a PR for this.

One thought comes to mind though - scripts and stylesheets don't have metadata to be able to control per script if they should be purged or not.

Do you see this as an issue? Would you add a toggle in the back end to control if they (individually) should be purged? Or just leave it on for all as an OOTB expectation that they will be purged?

jmcaveney commented 6 years ago

I would just start by automatically purging them. I don't see an instance where you'd want to keep them from being purged like you would content/media.

cyberknet commented 6 years ago

Hopefully the best kind of enhancement request where the user submits their own PR to implement it...

cyberknet commented 5 years ago

This enhancement is completed with PR #13 being merged.