I have around 7 javascript files (thanks to various jQuery plugins) and 4-5 CSS files for this Curious what is the best practice to deal with them, in which they should be loaded in the document? YSlow tells me that Javascript should be a file - where possible - finally included. Body end? It indicates that the delimiter looks like they do not write content or not all of my javascript file functions and jQuery code (all is ready when ready ()) so that should be fine.
So should I include a CSS and a Javascript file and include it in the rest? Do I add all my files to one? Should I give javascript to my tags at the end of my documents?
Edit: FWIW Yes it is PHP.
I would suggest using it, which will give you a single HTTP request for a group of JS or CSS files Lets create Minify also handles GZipping, compression and HTTP headers for client side caching.
Edit: Minify will also allow you to set up a request so that you can include separate files for different pages. For example, some pages may also have a core set of JS files with custom JS codes or core JS files on other pages.
While in development you normally include all the files and then when you come close to switch the output to minify and join all CSS and JS files in a single HTTP request for. It's easy to set up and work with it.
In addition, CSS files should be set in the head, and JS files should be served below, as JS files can write on your page and on a large scale-relevant issues.
Here's why you should include your JS files:
& lt; / Div & gt; & Lt ;! - Finish Footer - & gt; & Lt; Script type = "app / javascript" src = "http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" & gt; & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt; Edit: You can also see how your page should be set.
Comments
Post a Comment