I'm looking for a bit of advice please. I'm developing a reasonably large ASP.NET MVC 3 app.
There are hundreds of partials throughout the system, so that I can break down the application in to composable chunks. Many partials contains various JQuery or straight Javascript script blocks.
The problem is that each time a partial is included in a main page, the script block will obviously be included each time, which is not the desired effect, clearly.
I could put the scripts in the main page, but there are often lots of long, detailed scripts and I don't want to clutter the page if the scripts aren't needed. (Some times the partials can appear ZERO or more times).
What's the recommended approach that would allow the script block to be included IF and ONLY if a partial is included in the page AND also included it only once?
Thanks,
Simon.