Skip to content

Commit

Permalink
fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
phillip-haydon committed Aug 13, 2012
1 parent 5391f7f commit ca5f49b
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions NuGet/content/Mvc.Bundler.cs
Expand Up @@ -253,38 +253,37 @@ public static MvcHtmlString RenderJsBundle(this HtmlHelper html, string bundlePa
} }


public static MvcHtmlString RenderCssBundle(this HtmlHelper html, string bundlePath, BundleOptions options = BundleOptions.Minified, string media = null) public static MvcHtmlString RenderCssBundle(this HtmlHelper html, string bundlePath, BundleOptions options = BundleOptions.Minified, string media = null)
{ {
if (string.IsNullOrEmpty(bundlePath)) if (string.IsNullOrEmpty(bundlePath))
return MvcHtmlString.Empty; return MvcHtmlString.Empty;


if (!CachePaths()) BundleCache.SafeClear(); if (!CachePaths()) BundleCache.SafeClear();


return BundleCache.GetOrAdd(bundlePath, str => return BundleCache.GetOrAdd(bundlePath, str => {
{ var filePath = HostingEnvironment.MapPath(bundlePath);
var filePath = HostingEnvironment.MapPath(bundlePath);
var baseUrl = VirtualPathUtility.GetDirectory(bundlePath); var baseUrl = VirtualPathUtility.GetDirectory(bundlePath);
if (options == BundleOptions.Combined) if (options == BundleOptions.Combined)
return html.Css(bundlePath.Replace(".bundle", ""), media, options); return html.Css(bundlePath.Replace(".bundle", ""), media, options);
if (options == BundleOptions.MinifiedAndCombined) if (options == BundleOptions.MinifiedAndCombined)
return html.Css(bundlePath.Replace(".css.bundle", ".min.css"), media, options); return html.Css(bundlePath.Replace(".css.bundle", ".min.css"), media, options);
var cssFiles = File.ReadAllLines(filePath); var cssFiles = File.ReadAllLines(filePath);
var styles = new StringBuilder(); var styles = new StringBuilder();
foreach (var file in cssFiles) foreach (var file in cssFiles)
{ {
var cssFile = file.Trim().Replace(".less", ".css"); var cssFile = file.Trim().Replace(".less", ".css");
var cssSrc = Path.Combine(baseUrl, cssFile); var cssSrc = Path.Combine(baseUrl, cssFile);
styles.AppendLine( styles.AppendLine(
html.Css(cssSrc, media, options).ToString() html.Css(cssSrc, media, options).ToString()
); );
} }
return styles.ToString().ToMvcHtmlString(); return styles.ToString().ToMvcHtmlString();
}); });
} }
} }
} }

0 comments on commit ca5f49b

Please sign in to comment.