Can anyone can confirm the best idea for storing jquery code, initially i was inserting everything in the HEAD of a document but i am seeing more and more code being used across pages,
Is the best way to use include files .. with the extension .JS?
Anything else or better with respect to this?
What would be the best place to store my .js file if this is the case..
of the root i have
/css /scripts
etc ... /scripts is where my jquery files are... but should i be using the same for my .js files?
Anyone have some recommendation on directory structure?
You should store as much code as you can in .js files, because that would allow the browser to download just once and re-use in all requests.
If you include your code directly in the HEAD section as plain text you're forcing that code to be downloaded in each request, slowing down the page transfer.
The directory where you store the files is up to you really... I use /css and /js, but /scripts is used as well in many ocassions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With