Created
February 20, 2012 01:04
-
-
Save xpando/1866903 to your computer and use it in GitHub Desktop.
Custom base razor view page that resolves bundle urls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class MyViewPage<TModel> : System.Web.Mvc.WebViewPage<TModel> | |
{ | |
public override string Href(string path, params object[] pathParts) | |
{ | |
if (BundleTable.Bundles.Any(b => b.Path.Equals(path, StringComparison.InvariantCultureIgnoreCase))) | |
return BundleTable.Bundles.ResolveBundleUrl(path); | |
return base.Href(path, pathParts); | |
} | |
} | |
public abstract class MyViewPage : System.Web.Mvc.WebViewPage | |
{ | |
public override string Href(string path, params object[] pathParts) | |
{ | |
if (BundleTable.Bundles.Any(b => b.Path.Equals(path, StringComparison.InvariantCultureIgnoreCase))) | |
return BundleTable.Bundles.ResolveBundleUrl(path); | |
return base.Href(path, pathParts); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment