Whats the best practice to organize and load multiple, dependend js files

    General discussion

  • In my project I have multiple js files that need to be loaded in order to function properly.

    Is there a way of a "require" or "include" that we could use inside the JS files themself to ensure proper inclusion of code we need?

    Adding all the scripts to the HTML via script tags is error prone, cause you can easily forget a small script which will render your app faulty.

    Friday, February 3, 2012 5:50 AM

All replies

  • There is no other way to include files in your project other than to specify them in the HTML via script tags. Additionally, when building your VS solution, you must add them as well in order to create a package.

    The nice thing regarding errors in your application which may result from the behavior you described above, which is different from a legacy web application built using JS/HTML/CSS, is that unhandled errors cause your application to stop execution forcing you to fix the error before proceeding instead of allowing them to go unnoticed.

    Friday, February 17, 2012 4:42 PM