public static IHtmlContent Styles()

in src/PartsUnlimitedWebsite/ContentDeliveryNetworkExtensions.cs [71:96]


        public static IHtmlContent Styles(this IHtmlHelper helper, string contentPath)
        {
            if (string.IsNullOrWhiteSpace(contentPath))
            {
                throw new ArgumentOutOfRangeException(nameof(contentPath), contentPath, "Must not be null or whitespace");
            }

            var sb = new StringBuilder();
            var paths = Configuration == null ? new[] { contentPath } : Configuration.Styles[contentPath];

            foreach (var path in paths)
            {
                var script = new TagBuilder("link");

                script.MergeAttribute("rel", "stylesheet");
                script.MergeAttribute("href", path);

                using (var writer = new StringWriter())
                {
                    script.WriteTo(writer, HtmlEncoder.Default);
                    sb.AppendLine(writer.ToString());
                }
            }

            return new HtmlString(sb.ToString());
        }