I’d like to improve my page by combining and minifying javascript and CSS files. Since MVCContrib already contains a project called IncludeHandling, I took a look at that which unfortunately left me with unanswered questions:
There is quite a set of interfaces and objects involved in the process. Now I’m using Ninject.Mvc, but it seems that MvcContrib.IncludeHandling is using some additional (home-brewed?) DI? Can I work around this? Has anybody used this and can share some experiences?
Secondly, advice that is often heard is to put static content on different domains so the request does not contain cookies and the like, making it much easier for the server to handle the request. But how can I combine this with automatic inclusion handling – isn’t that necessarily served in the same application?
EDIT: Figured that there is really just a single resolve call in the whole thing, i really wonder why they use DI for that… Thinking about a fork there…
Well,
MvcContrib.IncludeHandlinguses MvcContrib’sDependencyResolverto find the necessary components. It’s not very well documented (see the sample site for more detail, although in that case uses a custom injector).For example,
MvcContrib.Castlehas aWindsorDependencyResolverfor that IoC container that you can mimic to use NInject (there may be something if you Google around).The initialization is quite verbose, but goes like this (container is the Windsor container, in your case, use NInject):
This way you can register all the dependencies that are needed. Beware that you need the includeHandler section in your web config.
I hope this helped.