I have been looking for a way to use Laravels Blade templating engine with non PHP file extensions (instead of file_name.blade.php
being able to use file_name.blade.js
or file_name.blade.css
) to no avail. I found a post that seems to describe how to do exactly this for Laravel 4, however it no longer seems to work in Laravel 5. The reason why I would like to do this is I have a Javascript file that looks something like this:
//JS stuff
@foreach($Model->Values as $Value)
{{ $Value->name . " = " . $Value->content . ";"}}
@endforeach
//More JS stuff
And a blade/php file that looks something like this:
//Blade stuff
<script type="text/javascript">
@include('js');
</script>
And this seems to be the nicest way of passing each value to javascript. Even if there is a nicer way of passing these values to javascript, the reason behind this question is to find if there is a way to parse a non PHP file with blade as I think that could be immensely useful.