From: [email protected] [mailto:[email protected]] On Behalf Of Peter van der Zee Sent: 27 January 2011 10:52 AM To: [email protected] Subject: Re: [JSMentors] Javascript file organisation
On Thu, Jan 27, 2011 at 9:36 AM, Smith, Garren <[email protected]<mailto:[email protected]>> wrote: Hi All, I want to know what is the best practice or how everyone organises there javascript files. I initially use to just embed all my js in the html file but that gets messy quick. Now I create an application.js file that I reference on all pages. This is slightly better but often there is code only specific to a page. Do you guys embed that in the html page? This will probably all kinds of styles, I don't think there any best practices specific to js though. Here's what I do. Every object get's a file of its own. Capitalized, to make clear it's about an object (and not some initialization code, or whatever). If more complex inheritance or if modules are used, I'll apply a folder structure that reflects this. For any web project, all the js files go in a js (sub)folder (likewise, the css goes in a css folder). - peter What about specific jQuery or your library uses for a particular page? This e-mail is subject to a disclaimer, available at http://www.firstrand.co.za/content/376/disclaimer/ -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
