On Thu, Jan 27, 2011 at 9:36 AM, Smith, Garren <[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 -- 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]
