mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Added cache busters for Webpack scripts.
This commit is contained in:
parent
4f6f64a3c0
commit
840e233acf
3 changed files with 24 additions and 13 deletions
|
@ -20,6 +20,28 @@
|
|||
|
||||
class Assets
|
||||
{
|
||||
public static function scriptIncludes(string $area) {
|
||||
$scriptTags = '';
|
||||
|
||||
if ('app' === $area) {
|
||||
$scripts = ['app.js', 'templates.js'];
|
||||
} elseif ('embed' === $area) {
|
||||
$scripts = ['embed.js'];
|
||||
} else {
|
||||
throw new InvalidArgumentException('A valid app area must be specified!');
|
||||
}
|
||||
|
||||
foreach ($scripts as $filename) {
|
||||
$scriptTags .= "<script src='/build/scripts/{$filename}?" . filemtime(public_path("build/scripts/{$filename}")) . "'></script>";
|
||||
}
|
||||
|
||||
if (Config::get("app.debug")) {
|
||||
$scriptTags .= '<script src="http://localhost:61999/webpack-dev-server.js"></script>';
|
||||
}
|
||||
|
||||
return $scriptTags;
|
||||
}
|
||||
|
||||
public static function styleIncludes($area = 'app')
|
||||
{
|
||||
if (!Config::get("app.debug")) {
|
||||
|
|
|
@ -158,13 +158,7 @@
|
|||
</script>
|
||||
@endif
|
||||
|
||||
@if (Config::get("app.debug"))
|
||||
<script src="http://localhost:61999/build/scripts/app.js"></script>
|
||||
<script src="http://localhost:61999/webpack-dev-server.js"></script>
|
||||
@else
|
||||
<script src="/build/scripts/app.js"></script>
|
||||
<script src="/build/scripts/templates.js"></script>
|
||||
@endif
|
||||
{!! Assets::scriptIncludes('app') !!}
|
||||
|
||||
@yield('app_scripts')
|
||||
|
||||
|
|
|
@ -62,12 +62,7 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
@if (Config::get("app.debug"))
|
||||
<script src="http://localhost:61999/build/scripts/embed.js"></script>
|
||||
<script src="http://localhost:61999/webpack-dev-server.js"></script>
|
||||
@else
|
||||
<script src="/build/scripts/embed.js"></script>
|
||||
@endif
|
||||
{!! Assets::scriptIncludes('embed') !!}
|
||||
|
||||
@if(config('ponyfm.google_analytics_id'))
|
||||
<script type="text/javascript">
|
||||
|
|
Loading…
Reference in a new issue