public ActionResult Css(string name) { var asset = AssetDiscovery.FindByName(name); var compressor = this.GetStyleBundler(asset); string contents = compressor.Compress(); this.Response.Cache.SetMaxAge(TimeSpan.FromMinutes(asset.CacheDurationInMinutes)); return(this.Content(contents, "text/css")); }
public ActionResult Js(string name) { var asset = AssetDiscovery.FindByName(name); if (asset == null) { return(this.HttpNotFound()); } var compressor = this.GetScriptBundler(asset); string contents = compressor.Compress(); this.Response.Cache.SetMaxAge(TimeSpan.FromMinutes(asset.CacheDurationInMinutes)); return(this.Content(contents, "text/javascript")); }
public ActionResult Css(string name) { var asset = AssetDiscovery.FindByName(name); string key = "assets.styles." + name; string contents = this.GetContents(key); if (string.IsNullOrWhiteSpace(contents)) { var compressor = new StyleBundler(Log.Logger, asset); contents = compressor.Compress(); this.SetContents(key, contents, DateTimeOffset.UtcNow.AddMinutes(asset.CacheDurationInMinutes)); } this.Response.Cache.SetMaxAge(TimeSpan.FromMinutes(asset.CacheDurationInMinutes)); return(this.Content(contents, "text/css")); }