Laravel Mix best practice for application-level scripts and styles

Permalink
Hi all,

First of all I'd like to say I'm very happy with the quick and clear answers I've been getting here.. people always tell me they're scared to use anything else than WordPress because of its "big support community" but from what I've seen of the support here, it's definitely a case of quality over quantity. :)

I'm still a bit new to using C5.8 the composer/npm-way, and I'm very charmed by how this makes it the ideal middle ground between using an easy CMS and building a professional application with a real framework.

But I'm still a bit confused how it works and documentation is scarce. :)

If I create application-level css and js (like the empty examples provided with the default composer installation), what is the correct way to include those files in the actual pages? I can override the theme's header element (I know how that works) :) and include them manually, but with all this nice provisioning stuff I'd expect there to be some way to tell C5 to include my generated css everywhere?

If I do have to include them 'by hand' in a header element, then what's the proper way to reference the generated files? Should I just specify the absolute path where I know the compiled files end up, or is there some helper function that gives you the url of generated assets (like in Laravel)?

 
JohntheFish replied on at Permalink Reply
JohntheFish
Rather than override aspects of the default theme, create a new theme. Cloneamental or Elemental Cloner are good starting points. There are also some free re-skins of Elemental that show how others have done similar.

If you need your own js or css above that, you can add it directly to the footer / header of your custom theme, or for more complex script register it as an asset in the theme's package controller then require the asset in the on_start event handlers of the blocks or pages where it is needed.