3
votes

My idea is to use laravel blade in the <template></template> of a vue/vueify component. I am not sure how to get the blade processor to run and output the html into the template inside the .vue file or in an imported template file.

2
That's a horrible idea. IDE will be mad. Compiler will be mad. And I really see no point in doing so. Why not just use .vue files for the sake of it?Yauheni Prakopchyk
Yeah I had not even tried it, I was stuck in the conceptual part.jjohnson
You're stuck because this shouldn't be done.ceejayoz

2 Answers

2
votes

I don't believe what he's trying to do is preposterous.

I find that there're things that Laravel blade does better than Vue and just want to get a prepared blade run template to be returned asynchronously using vue resource.

What you can do is actually make vue blade templates. That are actually then passed by Laravel via a route that returns a view that has vue code. That way it enables the user of blade templates to do what he does best in PHP and blade them return a good vue template that had code.

1
votes

If you have the template inline then you can output whatever you want inside of it ( from your something.blade.php file ):

<super-duper-component inline-template >

{!! $some_php_variable_sent_to_the_view !!}

@{{ $data.someVueDataProperty | json }}

</super-duper-component>

You can use the blade @include('path-to.super-duper-component') to include this snippet from a simple super-duper-component.blade.php file so you can keep the component's template in one location for maintaining the template in the future.