Sitefinity is one of the most powerful and feature rich CMS systems out there, and there is no doubt that we here at Falafel love working on it.
The real challenge was to be able to parse the HTML and remove all the resources. There is a great concern about performance and what impact will it going to have on the website. I needed a library that could do it efficiently and has a light footprint on the rendering of the page. If you’re not familiar with HAP, let me introduce it to you.
What is exactly the Html Agility Pack (HAP)?
This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don’t HAVE to understand XPATH nor XSLT to use it, don’t worry…). It is a .NET code library that allows you to parse “out of the web” HTML files. The parser is very tolerant with “real world” malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).
With that said, here is what I came up with:
I only advise you to use it when you’re absolutely sure you don’t want those resources and you’re not using any control that requires any of those scripts.