Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gabotronix's avatar

Adding script with blade syntax in from app.js in Vue

Hi everybody, is it possible to add a javascript inline script to my html head page using javascript, in my app which uses laravel and vue I want to add the following script from the created method in my entry app.js file.

<script type="text/javascript">window.$app = {!! json_encode(app(App\Helpers\Javascript::class)->app) !!};</script>

As you can see there's some blade syntax in there.

Is it possible to do? I know I could add a partial to my master layout but something like what I'm trying to do is better/more maintaneable imo.

0 likes
0 replies

Please or to participate in this conversation.