Registering CSS and Javascriprt

Permalink
Hi, It would be awesome if someone could put together a quick How To on registering CSS and Javascript in a packages controller.php. I have been fiddling with it but have not got it to work, I think it is going to be a problem for others too.

thanks

pvernaglia
 
andrew replied on at Permalink Reply
andrew
I will be doing this this week.
pvernaglia replied on at Permalink Reply
pvernaglia
Hey Andrew, have you written up anything on requiring js and css yet? I need to have bootstrap/dropdown loaded for an add on, not sure the best way to do it.an I use it from the core js or need to include the file in the addon?

Thanks
andrew replied on at Permalink Reply
andrew
Not in the context of a block or a package – however some documentation is available at the theme level:

http://www.concrete5.org/index.php?cID=678686...

This describes how you can globally require core assets in a theme. It's really no different at the block or package level. If you need to globally require an asset, just add $this->requireAsset('type', 'handle') to the view() method of a block. At the package level it's a little tricker but it'll hopefully be available soon.
Pluto replied on at Permalink Reply
Pluto
This is helpful.
Thanks @pluto