Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asset route caching #1002

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 34 additions & 27 deletions src/AssetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,48 @@ public function registerAssetDirective()

public function registerAssetRoutes()
{
Route::get('/flux/flux.css', function () {
return Flux::pro()
? $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/flux.css', 'text/css')
: $this->pretendResponseIsFile(__DIR__.'/../../flux/dist/flux-lite.css', 'text/css');
});
Route::get('/flux/flux.css', [static::class, 'fluxCss']);
Route::get('/flux/flux.js', [static::class, 'fluxJs']);
Route::get('/flux/flux.min.js', [static::class, 'fluxMinJs']);
Route::get('/flux/editor.css', [static::class, 'editorCss']);
Route::get('/flux/editor.js', [static::class, 'editorJs']);
Route::get('/flux/editor.min.js', [static::class, 'editorMinJs']);
}

Route::get('/flux/flux.js', function () {
return Flux::pro()
? $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/flux.js', 'text/javascript')
: $this->pretendResponseIsFile(__DIR__.'/../../flux/dist/flux-lite.min.js', 'text/javascript');
});
public function fluxCss() {
return Flux::pro()
? $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/flux.css', 'text/css')
: $this->pretendResponseIsFile(__DIR__.'/../../flux/dist/flux-lite.css', 'text/css');
}

Route::get('/flux/flux.min.js', function () {
return Flux::pro()
? $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/flux.min.js', 'text/javascript')
: $this->pretendResponseIsFile(__DIR__.'/../../flux/dist/flux-lite.min.js', 'text/javascript');
});
public function fluxJs() {
return Flux::pro()
? $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/flux.js', 'text/javascript')
: $this->pretendResponseIsFile(__DIR__.'/../../flux/dist/flux-lite.min.js', 'text/javascript');
}

Route::get('/flux/editor.css', function () {
if (! Flux::pro()) throw new \Exception('Flux Pro is required to use the Flux editor.');
public function fluxMinJs() {
return Flux::pro()
? $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/flux.min.js', 'text/javascript')
: $this->pretendResponseIsFile(__DIR__.'/../../flux/dist/flux-lite.min.js', 'text/javascript');
}

return $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/editor.css', 'text/css');
});
public function editorCss() {
if (! Flux::pro()) throw new \Exception('Flux Pro is required to use the Flux editor.');

Route::get('/flux/editor.js', function () {
if (! Flux::pro()) throw new \Exception('Flux Pro is required to use the Flux editor.');
return $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/editor.css', 'text/css');
}

return $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/editor.js', 'text/javascript');
});
public function editorJs() {
if (! Flux::pro()) throw new \Exception('Flux Pro is required to use the Flux editor.');

Route::get('/flux/editor.min.js', function () {
if (! Flux::pro()) throw new \Exception('Flux Pro is required to use the Flux editor.');
return $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/editor.js', 'text/javascript');
}

return $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/editor.min.js', 'text/javascript');
});
public function editorMinJs() {
if (! Flux::pro()) throw new \Exception('Flux Pro is required to use the Flux editor.');

return $this->pretendResponseIsFile(__DIR__.'/../../flux-pro/dist/editor.min.js', 'text/javascript');
}

public static function scripts($options = [])
Expand Down