Overview
The TealSite static site generator uses HTML and CSS Selectors Level 3 to implement its template system. CSS selectors are processed by a hand-coded recursive descent parser that calls set filtering methods in order to match HTML tags within the document. TealSite could be extended to manage the author's CSS stylesheets in addition to handling the HTML. This way, an author working on a site with complex CSS would not need to use an external tool like Sass to manage stylesheets.
The first step in processing general CSS stylesheets is to implement a recursive-descent stylesheet parser that follows the CSS stylesheet context-free grammar. Once the individual parts of styles can be obtained from the input stylesheets, features like extending and merging styles can be implemented to produce combined output stylesheets.