This project has moved. For the latest updates, please go here.

jsAssetHandler and cssAssetHandler - pros and cons?

Jun 30, 2014 at 11:11 AM
Since including it I noticed that all my static js and css file requests are now going through BundleTransformer, which isn't what I want when the ASP.Net is still starting up. It appears to be down to these two lines;
      <add name="CssAssetHandler" path="*.css" verb="GET" type="BundleTransformer.Core.HttpHandlers.CssAssetHandler, BundleTransformer.Core" resourceType="File" preCondition=""/>
      <add name="JsAssetHandler" path="*.js" verb="GET" type="BundleTransformer.Core.HttpHandlers.JsAssetHandler, BundleTransformer.Core" resourceType="File" preCondition=""/>
Curious - because I thought BundleTransformer was a plugin for System.Web.Optimization and Minification seems to work equally well without these two handlers.

Q: So what features do they add over and above what's already built-in? I looked in the docs and the code but it wasn't immediately obvious what the significant feature set was.
Coordinator
Jun 30, 2014 at 12:03 PM
Hello, Daniel!

Not yet added to the documentation corresponding section.

CssAssetHandler and JsAssetHandler is a debugging HTTP-handlers (same as LessAssetHandler, SassAndScssAssetHandler, CoffeeScriptAssetHandler, TypeScriptAssetHandler, HoganAssetHandler, and HandlebarsAssetHandler). These two HTTP-handlers were created especially for such modules as BundleTransformer.Autoprefixer.

By default, these HTTP-handlers pass their requests to System.Web.StaticFileHandler. But if in the App_Start/BundleConfig.cs file add the following code:
BundleResolver.Current = new CustomBundleResolver();
Then these HTTP-handlers will apply the transformations from corresponding bundles (item transformations and postprocessors (property UseInDebugMode of postprocessor must be equals to true)) to files of bundle.
Jun 30, 2014 at 12:10 PM

Hi Taritsyn

Ah OK, so I don’t really need them. The issue is that although the delegate to the StaticFileHandler they do of course therefore redirect all traffic through the ASP.Net pipeline. I need my static files handled OUTSIDE ASP.Net by IIS. Performance is one reason, but largely I need them to work even if the ASP.Net app isn’t running, configured or working.

I use for example <applicationInitialization/> app preloads and the page that IIS shows whilst the app is starting can’t render because the CSS and JS files it needs are trying to go through the bundle.

Thanks!

Daniel

Coordinator
Jun 30, 2014 at 12:15 PM
OK, then I will remove the automatic installation of these debugging HTTP-handlers.
Coordinator
Jun 30, 2014 at 7:14 PM
Documentation updated.