Jump to content

javascript code organization


cbodapati
 Share

Recommended Posts

Hi,Iam new to js programming.I have some js code in 1 big file (2300 lines) and expecting to grow.I want to break it into 3-5 files. like separate the base types and instances.I want to know, if a base type is in base.js, then how do I include in a derived.js where I want to create an instance of what is declared in base.jsany help appreciated.thanks

Link to comment
Share on other sites

you might want to look into something like require.js. Ideally though, you do want all your JS in as few files as possible. One option is to use a build tool like Grunt to concatenate (and ideally minify) your script files at build time. So locally you get the full, developer friendly versions of the files, but then only include the single file for use in production.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...