Javascript in Blade

Have been building the project with the blade templates and javascript combined. By using conditional arguments in blade you can easily control which arguments and JS commands get combined in the final response. Easy to get everything centralized around a typical response, but….



This does make a blade template unreadable, you get a combination of HTML, Blade and JS (maybe even some CSS). So now we moved the JS code to functions in a seperate JS file, and it really cleans up. Just a few function calls is all the javascript that is left in the blade templates.


Tags: ,

Related Post