private static CssUsageInfo AnalyzeInternalStyles(Uri pageUrl, HtmlDocument html) { var inlineCss = html.GetInlineStyles(); var styleSheet = new CssStylesheet(pageUrl, inlineCss); return AnalyzeCssStylesheet(styleSheet, html); }
public async Task<PageAnalysisResult> Analyze(Uri pageUrl, HtmlDocument html) { var cssInfos = new List<CssUsageInfo>(); if (!String.IsNullOrWhiteSpace(html.GetInlineStyles())) { cssInfos.Add(AnalyzeInternalStyles(pageUrl, html)); } cssInfos.AddRange(await AnalyzeExternalStyles(pageUrl, html)); var filteredCssInfos = cssInfos.Where(z => z.UnusedSelectors.Any()).ToList(); return new PageAnalysisResult(pageUrl, filteredCssInfos) { InternalLinks = html.GetInternalLinks(pageUrl) }; }