I have multiple Javascript files, and lots of them are prepared by the laravel template engine. For example ill use:
@if ($group_id !== 3)
//do something here
@endif
Everthing is fine, when ill include this the javascript code directly into my filename.blade.php template.
But i would like to load all external with:
<script type="text/javascript">
$.getScript("js/pages/filename.js");
</script>
And so its not processed by the blade engine. Ill found some solutions for L4, but i am not really happy with them. For example youll should name your javascript files like javascript.blade.php and include it in that way - but so my IDE thinks its an PHP file and formats it totally wrong. Other solution here is to write your (group in this example) before you include it, like:
<script type="text/javascript">
var group = {!! $group_id !!}
$.getScript("js/pages/filename.js");
</script>
I am still not really happy with that solution, i would like that all files should be processed as it was included directly in my blade-file.
Is there a solution to handle that?
Thanks in advance.