mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-09 11:16:39 -05:00
Implement cache busting for javascript and css assets
This commit is contained in:
parent
a824c12669
commit
3ce19f871c
4 changed files with 18 additions and 8 deletions
|
@ -6,6 +6,8 @@ APP_DEBUG=true
|
||||||
APP_KEY=random_string
|
APP_KEY=random_string
|
||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
CACHE_BUST=
|
||||||
|
|
||||||
LR_HOST=localhost
|
LR_HOST=localhost
|
||||||
|
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
|
|
10
init.sh
10
init.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
deps=('bower' 'composer' 'gulp' 'npm' 'php')
|
deps=('bower' 'composer' 'egrep' 'gulp' 'npm' 'php' 'sed')
|
||||||
|
|
||||||
# Colour scheme
|
# Colour scheme
|
||||||
[[ -t 1 ]] && {
|
[[ -t 1 ]] && {
|
||||||
|
@ -59,6 +59,14 @@ trap 'error "script killed"' SIGINT SIGQUIT
|
||||||
msg "Running: ${c_m}composer installl --no-dev"
|
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"
|
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='"$(</dev/urandom tr -dc A-Za-z0-9 | head -c"${1:-32}")"'|' .env
|
||||||
|
|
||||||
msg "Running: ${c_m}php artisan migrate"
|
msg "Running: ${c_m}php artisan migrate"
|
||||||
php artisan migrate || error "${c_m}php artisan migrate$c_w exited with an error status"
|
php artisan migrate || error "${c_m}php artisan migrate$c_w exited with an error status"
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
@extends('layouts.base')
|
@extends('layouts.base')
|
||||||
|
|
||||||
@section('page-includes')
|
@section('page-includes')
|
||||||
<script src="/js/lib-dashboard.js"></script>
|
<script src="/js/lib-dashboard.js?version={{ env('CACHE_BUST') }}"></script>
|
||||||
<script src="/js/dashboard.js"></script>
|
<script src="/js/dashboard.js?version={{ env('CACHE_BUST') }}"></script>
|
||||||
<link rel="stylesheet" href="/css/dashboard.css" />
|
<link rel="stylesheet" href="/css/dashboard.css?version={{ env('CACHE_BUST') }}" />
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('page-top')
|
@section('page-top')
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
@extends('layouts.base')
|
@extends('layouts.base')
|
||||||
|
|
||||||
@section('page-includes')
|
@section('page-includes')
|
||||||
<script src="/js/modernizr.js"></script>
|
<script src="/js/modernizr.js?version={{ env('CACHE_BUST') }}"></script>
|
||||||
<script src="/js/lib.js"></script>
|
<script src="/js/lib.js?version={{ env('CACHE_BUST') }}"></script>
|
||||||
<script src="/js/app.js"></script>
|
<script src="/js/app.js?version={{ env('CACHE_BUST') }}"></script>
|
||||||
<link rel="stylesheet" href="/css/app.css" />
|
<link rel="stylesheet" href="/css/app.css?version={{ env('CACHE_BUST') }}" />
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('page-top')
|
@section('page-top')
|
||||||
|
|
Loading…
Reference in a new issue