From 3ce19f871c6a03ae6e39076e220a09b21cddbbb3 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Wed, 1 Jun 2016 22:59:52 -0400 Subject: [PATCH] Implement cache busting for javascript and css assets --- .env.example | 2 ++ init.sh | 10 +++++++++- resources/views/layouts/dashboard.blade.php | 6 +++--- resources/views/layouts/public.blade.php | 8 ++++---- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index e8ddc62..abf3cf1 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,8 @@ APP_DEBUG=true APP_KEY=random_string APP_URL=http://localhost +CACHE_BUST= + LR_HOST=localhost DB_HOST=localhost diff --git a/init.sh b/init.sh index a5c8929..fdb0217 100755 --- a/init.sh +++ b/init.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # dependencies -deps=('bower' 'composer' 'gulp' 'npm' 'php') +deps=('bower' 'composer' 'egrep' 'gulp' 'npm' 'php' 'sed') # Colour scheme [[ -t 1 ]] && { @@ -59,6 +59,14 @@ trap 'error "script killed"' SIGINT SIGQUIT msg "Running: ${c_m}composer installl --no-dev" composer install --no-interaction --no-dev || error "${c_m}composer install --no-interaction --no-dev$c_w exited with an error status" +egrep -q '^CACHE_BUST=' .env || { + msg "Adding the ${c_y}CACHE_BUST$c_w variable" + printf '\n%s\n' 'CACHE_BUST=' >> .env +} + +msg "Updating ${c_y}CACHE_BUST$c_w variable" +sed -i 's|^CACHE_BUST=.*|CACHE_BUST='"$( - - + + + @endsection @section('page-top') diff --git a/resources/views/layouts/public.blade.php b/resources/views/layouts/public.blade.php index c5886c4..22243e5 100644 --- a/resources/views/layouts/public.blade.php +++ b/resources/views/layouts/public.blade.php @@ -1,10 +1,10 @@ @extends('layouts.base') @section('page-includes') - - - - + + + + @endsection @section('page-top')