CodeIgniter Forums
On page CSS or JavaScript inclusion - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: On page CSS or JavaScript inclusion (/showthread.php?tid=74464)



On page CSS or JavaScript inclusion - pc87 - 09-26-2019

Does CI4 support on-page CSSĀ or JavaScript inclusion like in Laravel allow?


RE: On page CSS or JavaScript inclusion - includebeer - 09-29-2019

What do you mean by that? You can put whatever you want in your view. CSS and JavaScript can be added inline or loaded from external files.


RE: On page CSS or JavaScript inclusion - pc87 - 09-30-2019

(09-29-2019, 06:43 AM)includebeer Wrote: What do you mean by that? You can put whatever you want in your view. CSS and JavaScript can be added inline or loaded from external files.

I know that we can insert js and css on view, but like in Laravel it add css and javascript to header or footer. is that kind of option available in CI4?


RE: On page CSS or JavaScript inclusion - MGatner - 09-30-2019

There's nothing like that in the framework - though do check out the HTML helper as it can handle tags for you:
https://codeigniter4.github.io/CodeIgniter4/helpers/html_helper.html

You might also be interested in this module which assists with CSS & JavaScript tags in header & footer:
https://forum.codeigniter.com/thread-73060.html


RE: On page CSS or JavaScript inclusion - John_Betong - 10-03-2019

When the AmpProject.org was introduced I created an online utility to create an Amp template by sending the required JavaScript components by get numeric parameters. This was necessary because Amp does not validate pages if there are unused JavaScripts included in the page.

The controller checked the URL parameters and only selected the required JavaScript files then concatenated the relevant files which was inserted into the web page.


https://amphtmldemo.tk/create-template