diff --git a/app/Http/View/Composers/FootComposer.php b/app/Http/View/Composers/FootComposer.php index 78e9c3d3..7cbb56f9 100644 --- a/app/Http/View/Composers/FootComposer.php +++ b/app/Http/View/Composers/FootComposer.php @@ -6,6 +6,7 @@ use App\Models\User; use App\Services\Webpack; use Illuminate\View\View; use Illuminate\Http\Request; +use Illuminate\Support\Str; use App\Services\Translations\JavaScript; use Illuminate\Contracts\Events\Dispatcher; @@ -53,6 +54,9 @@ class FootComposer if ($this->request->is('admin*') && auth()->user()->permission >= User::SUPER_ADMIN) { $scripts[] = $this->webpack->url('check-updates.js'); } + if (Str::startsWith(config('app.asset.env'), 'dev')) { + $scripts[] = $this->webpack->url('style.js'); + } $scripts[] = $this->webpack->url('index.js'); $view->with([ diff --git a/tests/HttpTest/ViewTest/ComposersTest/FootComposerTest.php b/tests/HttpTest/ViewTest/ComposersTest/FootComposerTest.php index 12069914..7161a3f2 100644 --- a/tests/HttpTest/ViewTest/ComposersTest/FootComposerTest.php +++ b/tests/HttpTest/ViewTest/ComposersTest/FootComposerTest.php @@ -25,6 +25,7 @@ class FootComposerTest extends TestCase $crawler = new Crawler($this->get('/user')->getContent()); $this->assertCount(0, $crawler->filter('#disallowed')); + config(['app.asset.env' => 'development']); $this->mock(JavaScript::class, function ($mock) { $mock->shouldReceive('generate') ->with('en') @@ -42,6 +43,10 @@ class FootComposerTest extends TestCase ->with('check-updates.js') ->once() ->andReturn('check-updates.js'); + $mock->shouldReceive('url') + ->with('style.js') + ->atLeast(1) + ->andReturn('style.js'); $mock->shouldReceive('url') ->with('index.js') ->twice()