0

I'm using jQuery plugins in an ASP.Net MVC site.

I've often to include CSS and JS files as required by the plugins I use in every page. So I want to centralize all those dependencies in a single place in my app. thus if a dependency for a given plug-in is changed or updated, I'll only have to modify a single place in my app.

I've thought in two possible solutions:

  • Extend the HTMLHelper with a partial method like GetPlugin("jqgrid"); that will print out all the script and style tags needed.

  • Create a partial view for each pluginlike jqGridDependencies.ascx that will contain the script and style tags needed.

Do you have any other idea? what do you think of both proposals?

1
  • Yes, I am. but the dependency requirements of each page may vary so much. (because each individual page requires just a little group of components). Commented Nov 4, 2010 at 18:39

1 Answer 1

4

Could http://combres.codeplex.com/ provide you with a framework for this.

My only personal objection to this method is that each individual pages will have a unique JavaScript/CSS file where as if you combined and compressed everything into one and simply used classes and events to trigger the JavaScript enhancements as and when needed your site would run a lot faster.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.