The SignalR github repository extensibility at https://github.com/SignalR/SignalR/wiki/Extensibility indicates that you can replace the
IJavaScriptMinifier which I have done in the Global.asax Application_Start event:-
protected void Application_Start()
{
Microsoft.AspNet.SignalR.GlobalHost.DependencyResolver.Register(typeof(Microsoft.AspNet.SignalR.Hubs.IJavaScriptMinifier), () => new Common.HubMin());
// Register the default hubs route: ~/signalr
RouteTable.Routes.MapHubs();
....
}
public class HubMin : Microsoft.AspNet.SignalR.Hubs.IJavaScriptMinifier
{
public string Minify(string source)
{
CodeSettings settings = new CodeSettings
{
PreserveImportantComments = false,
PreserveFunctionNames = true
};
Minifier doMin = new Minifier();
string mind = doMin.MinifyJavaScript(source, settings);
return mind;
}
}
I have checked in the debugger that this function is being called and the minified source is being returned, however the hubs.js file still remains unminified.
Any clues??
This only works at runtime not if you're running SignalR.exe.