Welcome Guest, Not a member yet? Register   Sign In
JS Organizer?
#1

[eluser]stuffradio[/eluser]
I'm finding myself adding a lot of lines in my header file for JS. Is there anything I can do to limit the amount of space in the header that I use for when I am including js files?
#2

[eluser]Dam1an[/eluser]
The most obvious solution that comes to mind is to use some system to compress all the files into a single one, this also has the benefit of less data to transfer and fewer HTTP requests. (I can't think of any off the top of my head, but just google it)

But I'm more concerned about the cause of the problem, just how many JS files we talking about? I'm either concerned you're loading so many files per page, or you need to restructure the way you handle the files, merge some etec
#3

[eluser]Michael Wales[/eluser]
YUI JS Compressor is recommended by the jQuery team.
#4

[eluser]stuffradio[/eluser]
Dam1an I have a header file that I am trying to load certain js files for certain pages.

My structure is setup as such that I'm handling all the page loading through 1 file. It's called page.php. To go to a page you would go

http://myurl.com/page/pagename and in the page.php file I would check the uri for the pagename and load the file accordingly. Then for the header I would check the uri as well and load certain js files for the different pages.

Any idea of a better way to set it up? I'm just wanting to use one page for this project (it's an admin panel).
#5

[eluser]Johan André[/eluser]
Check out Carabiner. It's perfect for the job. It also combines CSS and minify (compresses) it.
Really cool lib. It's in the wiki pages...
#6

[eluser]stuffradio[/eluser]
I will look at this Johan.

It looks like you just pass the js/css files like you would otherwise right?

Code:
$cssfile = $this->carabiner->css('myfile.css');

$this->load->view('viewname', $cssfile);
Am I right in thinking this?




Theme © iAndrew 2016 - Forum software by © MyBB