cwgw
June 5, 2021, 2:29am
1
Blade has a @once
directive that’s just what I need at the moment. But, it doesn’t seem to work in Sage.
Doing something like this…
@once
@push('scripts')
<script>console.log('pushed!');</script>
@endpush
@endonce
…successfully pushes the script tag to the ‘scripts’ stack, but the @once
directive appears to be ignored. @once
and @endonce
just end up as strings in the markup.
Is @once
supported in Sage?
What Sage are you using? Sage 9, Sage 9 update branch or Sage 10?
According to Blade documentation, the @once
directive became available with Blade 7.x
.
From what I understand, Sage 9 uses the standalone Blade compiler from illuminate/view
:
<?php
namespace Illuminate\View\Compilers;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use InvalidArgumentException;
class BladeCompiler extends Compiler implements CompilerInterface
{
use Concerns\CompilesAuthorizations,
Concerns\CompilesComments,
Concerns\CompilesComponents,
Concerns\CompilesConditionals,
Concerns\CompilesEchos,
Concerns\CompilesErrors,
Concerns\CompilesHelpers,
Concerns\CompilesIncludes,
Concerns\CompilesInjections,
Concerns\CompilesJson,
This file has been truncated. show original
system
Closed
July 17, 2021, 2:29am
3
This topic was automatically closed after 42 days. New replies are no longer allowed.