mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-21 23:52:31 -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_URL=http://localhost
|
||||
|
||||
CACHE_BUST=
|
||||
|
||||
LR_HOST=localhost
|
||||
|
||||
DB_HOST=localhost
|
||||
|
|
10
init.sh
10
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='"$(</dev/urandom tr -dc A-Za-z0-9 | head -c"${1:-32}")"'|' .env
|
||||
|
||||
msg "Running: ${c_m}php artisan migrate"
|
||||
php artisan migrate || error "${c_m}php artisan migrate$c_w exited with an error status"
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
@extends('layouts.base')
|
||||
|
||||
@section('page-includes')
|
||||
<script src="/js/lib-dashboard.js"></script>
|
||||
<script src="/js/dashboard.js"></script>
|
||||
<link rel="stylesheet" href="/css/dashboard.css" />
|
||||
<script src="/js/lib-dashboard.js?version={{ env('CACHE_BUST') }}"></script>
|
||||
<script src="/js/dashboard.js?version={{ env('CACHE_BUST') }}"></script>
|
||||
<link rel="stylesheet" href="/css/dashboard.css?version={{ env('CACHE_BUST') }}" />
|
||||
@endsection
|
||||
|
||||
@section('page-top')
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
@extends('layouts.base')
|
||||
|
||||
@section('page-includes')
|
||||
<script src="/js/modernizr.js"></script>
|
||||
<script src="/js/lib.js"></script>
|
||||
<script src="/js/app.js"></script>
|
||||
<link rel="stylesheet" href="/css/app.css" />
|
||||
<script src="/js/modernizr.js?version={{ env('CACHE_BUST') }}"></script>
|
||||
<script src="/js/lib.js?version={{ env('CACHE_BUST') }}"></script>
|
||||
<script src="/js/app.js?version={{ env('CACHE_BUST') }}"></script>
|
||||
<link rel="stylesheet" href="/css/app.css?version={{ env('CACHE_BUST') }}" />
|
||||
@endsection
|
||||
|
||||
@section('page-top')
|
||||
|
|
Loading…
Reference in a new issue