Automatic Assets CacheBust in Laravel (v4+, v5+)

there many packages including elixir that already does that but not in an efficient way and it needs more configure from your part, however the recommended method is to simply add

?v=

to the end of the asset, now this is much easier and you don’t need to do any extra work but this sadly requires you to manually add a number everytime you update the asset 😥.

so to tackle this i came up with a simple solution which automatically does that for you💃 🎉.

// before
{{ asset('css/style.css') }}

// after
{{ bustfy('css/style.css') }}

and you get something like

href="http://my-site.com/css/style.css?v=1476312636"

head over to github @ https://github.com/ctf0/AssetCacheBust

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s