Ejemplo n.º 1
0
        private static string GetAssetUrl(string virtualPath)
        {
            var assetName     = virtualPath.Split('/').Last();
            var isStaticAsset = virtualPath.IndexOf("/static/", StringComparison.OrdinalIgnoreCase) >= 0;

            var result = isStaticAsset
                ? UrlFilters.StaticAssetUrl(assetName)
                : UrlFilters.AssetUrl(assetName);

            return(result);
        }
Ejemplo n.º 2
0
        public static string StylesheetBundleTag(string input)
        {
            var retVal = string.Empty;

            var bundle = BundleTable.Bundles.GetBundleFor(input);

            if (bundle != null)
            {
                if (OptimizeStaticContent)
                {
                    var url = BundleTable.Bundles.ResolveBundleUrl(input);
                    retVal = HtmlFilters.StylesheetTag(url);
                }
                else
                {
                    var response = bundle.GenerateBundleResponse(new BundleContext(new HttpContextWrapper(HttpContext.Current), BundleTable.Bundles, string.Empty));
                    retVal = string.Join("\r\n", response.Files.Select(f => HtmlFilters.StylesheetTag(UrlFilters.AssetUrl(f.IncludedVirtualPath.Split('/').Last()))));
                }
            }

            return(retVal);
        }