public string Render(StylesheetBundle bundle) { var url = urlGenerator.CreateBundleUrl(bundle); var html = new StringBuilder(); var hasCondition = !string.IsNullOrEmpty(bundle.Condition); if (hasCondition) { html.AppendLine("<!--[if " + bundle.Condition + "]>"); } if (string.IsNullOrEmpty(bundle.Media)) { html.AppendFormat(HtmlConstants.LinkHtml, url); } else { html.AppendFormat(HtmlConstants.LinkWithMediaHtml, url, bundle.Media); } if (hasCondition) { html.AppendLine(); html.Append("<![endif]-->"); } return(html.ToString()); }
public string Render(StylesheetBundle bundle) { var url = urlGenerator.CreateBundleUrl(bundle); var conditionalRenderer = new ConditionalRenderer(); return(conditionalRenderer.Render(bundle.Condition, html => RenderLink(bundle, html, url))); }
public string Render(ScriptBundle bundle) { return(string.Format( HtmlConstants.ScriptHtml, urlGenerator.CreateBundleUrl(bundle) )); }
public string Render(StylesheetBundle bundle) { var url = urlGenerator.CreateBundleUrl(bundle); var conditionalRenderer = new ConditionalRenderer(); return(conditionalRenderer.Render(bundle.Condition, html => { if (string.IsNullOrEmpty(bundle.Media)) { html.AppendFormat( HtmlConstants.LinkHtml, url, bundle.HtmlAttributes.CombinedAttributes ); } else { html.AppendFormat( HtmlConstants.LinkWithMediaHtml, url, bundle.Media, bundle.HtmlAttributes.CombinedAttributes ); } })); }
public string Render(HtmlTemplateBundle bundle) { return(string.Format( "<script src=\"{0}\" type=\"text/javascript\"></script>", urlGenerator.CreateBundleUrl(bundle) )); }
public string Render(HtmlTemplateBundle bundle) { return(string.Format( "<script src=\"{0}\" type=\"text/javascript\"{1}></script>", urlGenerator.CreateBundleUrl(bundle), bundle.HtmlAttributes.CombinedAttributes )); }
public string CreateBundleUrl(Bundle bundle) { var theme = string.Empty; if (bundle.HtmlAttributes.ContainsAttribute("data-theme")) { theme = bundle.HtmlAttributes["data-theme"]; } return(new Url(_inner.CreateBundleUrl(bundle)).AppendQuery("theme", theme)); }
object HtmlTemplateData(HtmlTemplateBundle htmlTemplate, IUrlGenerator urlGenerator) { return(new { htmlTemplate.Path, Url = urlGenerator.CreateBundleUrl(htmlTemplate), Assets = AssetPaths(htmlTemplate, urlGenerator), htmlTemplate.References, Size = BundleSize(htmlTemplate) }); }
public virtual IEnumerable <string> GetUrls(bool isDebuggingEnabled, IUrlGenerator urlGenerator) { if (isDebuggingEnabled) { var collector = new CollectLeafAssets(); Accept(collector); return(collector.Assets.Select(urlGenerator.CreateAssetUrl)); } else { return(new[] { urlGenerator.CreateBundleUrl(this) }); } }
public string Render(ScriptBundle bundle) { var url = urlGenerator.CreateBundleUrl(bundle); var content = string.Format( HtmlConstants.ScriptHtml, url, bundle.HtmlAttributes.CombinedAttributes ); var conditionalRenderer = new ConditionalRenderer(); return(conditionalRenderer.Render(bundle.Condition, html => html.Append(content))); }
object ScriptData(ScriptBundle script, IUrlGenerator urlGenerator) { var external = script as ExternalScriptBundle; return(new { script.Path, Url = external == null?urlGenerator.CreateBundleUrl(script) : external.Url, Assets = AssetPaths(script, urlGenerator), script.References, Size = BundleSize(script) }); }
public string Url <T>(string bundlePath) where T : Bundle { using (bundles.GetReadLock()) { var bundle = bundles.FindBundlesContainingPath(bundlePath).OfType <T>().FirstOrDefault(); if (bundle == null) { throw new ArgumentException(string.Format("Bundle not found with path \"{0}\".", bundlePath)); } return(urlGenerator.CreateBundleUrl(bundle)); } }
object StylesheetData(StylesheetBundle stylesheet, IUrlGenerator urlGenerator) { var external = stylesheet as ExternalStylesheetBundle; return(new { stylesheet.Path, Url = external == null?urlGenerator.CreateBundleUrl(stylesheet) : external.Url, stylesheet.Media, stylesheet.Condition, Assets = AssetPaths(stylesheet, urlGenerator), stylesheet.References, Size = BundleSize(stylesheet) }); }
public IEnumerable <string> GetStylesheetUrls(string path) { using (bundles.GetReadLock()) { var bundle = bundles.FindBundlesContainingPath(path).OfType <StylesheetBundle>().FirstOrDefault(); if (bundle == null) { return(Enumerable.Empty <string>()); } if (settings.IsDebuggingEnabled) { return(bundle.Assets.Select(urlGenerator.CreateAssetUrl)); } else { return(new[] { urlGenerator.CreateBundleUrl(bundle) }); } } }
public List<string> GetUrls(IUrlGenerator urlGenerator, bool isDebuggingEnabled) { string path = isDebuggingEnabled ? urlGenerator.CreateAssetUrl(Asset) : urlGenerator.CreateBundleUrl(Bundle) + "?"; var urls = new List<string> { path }; var externalBundle = Bundle as IExternalBundle; if (externalBundle != null) { var externalUrl = externalBundle.ExternalUrl; if (externalUrl.EndsWith(".js")) { externalUrl = externalUrl.Substring(0, externalUrl.Length - 3); } urls.Insert(0,externalUrl); } return urls; }
public List<string> GetUrls(IUrlGenerator urlGenerator, bool isDebuggingEnabled) { return new List<string> { urlGenerator.CreateBundleUrl(this.Bundle) + "?"}; }
object StylesheetData(StylesheetBundle stylesheet, IUrlGenerator urlGenerator) { var external = stylesheet as ExternalStylesheetBundle; return new { stylesheet.Path, Url = external == null ? urlGenerator.CreateBundleUrl(stylesheet) : external.Url, stylesheet.Media, stylesheet.Condition, Assets = AssetPaths(stylesheet, urlGenerator), stylesheet.References, Size = BundleSize(stylesheet) }; }
object ScriptData(ScriptBundle script, IUrlGenerator urlGenerator) { var external = script as ExternalScriptBundle; return new { script.Path, Url = external == null ? urlGenerator.CreateBundleUrl(script) : external.Url, Assets = AssetPaths(script, urlGenerator), script.References, Size = BundleSize(script) }; }
object HtmlTemplateData(HtmlTemplateBundle htmlTemplate, IUrlGenerator urlGenerator) { return new { htmlTemplate.Path, Url = urlGenerator.CreateBundleUrl(htmlTemplate), Assets = AssetPaths(htmlTemplate, urlGenerator), htmlTemplate.References, Size = BundleSize(htmlTemplate) }; }
internal virtual IEnumerable<string> GetUrls(bool isDebuggingEnabled, IUrlGenerator urlGenerator) { if (isDebuggingEnabled) { var collector = new CollectLeafAssets(); Accept(collector); return collector.Assets.Select(urlGenerator.CreateAssetUrl); } else { return new[] { urlGenerator.CreateBundleUrl(this) }; } }
string CreateUrl(IAmdModule amdModule) { return(isDebuggingEnabled ? urlGenerator.CreateAssetUrl(amdModule.Asset) : urlGenerator.CreateBundleUrl(amdModule.Bundle) + "?"); }