mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-19 19:34:23 +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
|
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')
|
public static function styleIncludes($area = 'app')
|
||||||
{
|
{
|
||||||
if (!Config::get("app.debug")) {
|
if (!Config::get("app.debug")) {
|
||||||
|
|
|
@ -158,13 +158,7 @@
|
||||||
</script>
|
</script>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (Config::get("app.debug"))
|
{!! Assets::scriptIncludes('app') !!}
|
||||||
<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
|
|
||||||
|
|
||||||
@yield('app_scripts')
|
@yield('app_scripts')
|
||||||
|
|
||||||
|
|
|
@ -62,12 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (Config::get("app.debug"))
|
{!! Assets::scriptIncludes('embed') !!}
|
||||||
<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
|
|
||||||
|
|
||||||
@if(config('ponyfm.google_analytics_id'))
|
@if(config('ponyfm.google_analytics_id'))
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
Loading…
Reference in a new issue