Welcome Guest, Not a member yet? Register   Sign In
How to dynamically load css and js per view (similar to WordPress's wp_enque_script)?
#2

(This post was last modified: 05-19-2016, 03:15 PM by PaulD. Edit Reason: minor edit )

I collect additional css files into an array called additional_css and pass it to the header_view. The header view just checks to see if it is set and if it is, outputs the css files in the header view in a foreach loop. Its a bit clunky but it works well for me. I do the same with JS files too in the footer_view, where I also have another array for additional inline js. I suppose it all depends on the complexity of your page formation and if you are using a templating system or themeing system or not.

What does Laravel do for page meta data? In CI I have yet another loop that checks to see if any meta data has been sent and if so sets it in the header. I do the same for canonical link settings too. Again clunky but works perfectly fine.
Reply


Messages In This Thread
RE: How to dynamically load css and js per view (similar to WordPress's wp_enque_script)? - by PaulD - 05-19-2016, 03:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB