A simple CSS parser and inliner library written in Go for processing and embedding styles in HTML.
Douceur is a Go library and command-line tool for parsing CSS and inlining styles into HTML documents. It solves the problem of embedding CSS directly within HTML, which is essential for scenarios like email template generation where external stylesheets are not supported. The library parses CSS into a structured format and applies styles as inline attributes, enhancing compatibility.
Go developers working on email template systems, document processors, or any application requiring CSS manipulation and HTML style embedding. It's also suitable for those needing a lightweight CSS parsing tool in Go.
Developers choose Douceur for its simplicity, reliability, and focused feature set—it does one thing well without bloat. Its integration with Go's ecosystem and ability to handle real-world CSS quirks make it a practical alternative to more complex solutions.
A simple CSS parser and inliner in Go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Focuses on straightforward CSS parsing and inlining without bloat, as emphasized in the README's philosophy, making it easy to integrate into Go projects.
Parser handles comments and malformed CSS gracefully, ensuring robust processing of real-world inputs, demonstrated in the code example with messy CSS.
Inliner adds equivalent HTML attributes like bgcolor for background-color, improving support for older email clients, as shown in the README example.
Provides a command-line interface for parsing CSS files and inlining HTML documents directly, with simple commands like 'douceur inline input.html'.
Explicitly stated in the README that it does not fetch external stylesheets, limiting use for documents with linked CSS or remote resources.
Relies on Gorilla CSS3 tokenizer and goquery, which can introduce versioning conflicts or increase project dependency complexity.
Inspired by CSS3 syntax but not fully compliant, potentially missing support for newer CSS features or complex selectors like media queries.