Are there any rust libraries implementing a CSS-like language?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/rust

Our great sponsors
  • SonarQube - Static code analysis for 29 languages.
  • OPS - Build and Run Open Source Unikernels
  • Scout APM - Less time debugging, more time building
  • grass

    A near-feature-complete Sass compiler written purely in Rust (by connorskees)

    There is also grass it's a sass/scss compiler. It's doesn't pass all of the sass specification test but is usable enough that eww uses eww uses it

  • eww

    ElKowars wacky widgets

    There is also grass it's a sass/scss compiler. It's doesn't pass all of the sass specification test but is usable enough that eww uses eww uses it

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

  • json-rust

    JSON implementation in Rust

    You can use my crate jss which is essentially just json with field and values of a css properties. I used the json crate here since it allows omitting double quotes on fields that are valid rust identifier. The jss crate has a generated css properties which are used as lookup, transforming to and fro kebab-case properties into snake_case in order make the css code a bit cleaner, while still allowing the use of double quoted fields.

  • kuchiki

    (朽木) HTML/XML tree manipulation library for Rust

    You could use https://lib.rs/crates/cssparser + https://lib.rs/crates/selectors - or, if you are willing to convert your tree to DOM just for querying, there are other libraries like https://lib.rs/crates/simplecss, https://lib.rs/crates/nipper, https://github.com/kuchiki-rs/kuchiki or https://github.com/khvzak/victoria-dom

  • victoria-dom

    HTML parser with CSS selectors written in Rust

    You could use https://lib.rs/crates/cssparser + https://lib.rs/crates/selectors - or, if you are willing to convert your tree to DOM just for querying, there are other libraries like https://lib.rs/crates/simplecss, https://lib.rs/crates/nipper, https://github.com/kuchiki-rs/kuchiki or https://github.com/khvzak/victoria-dom

  • differential-datalog

    An in-memory incremental Datalog engine based on Differential Dataflow (by ddlog-dev)

    If the css syntax is not required, but a question is about a flexible and performant rule engine, I would suggest Differential Datalog - I had a great experience, when I tried to implement a system with entities, with multiple inheritance, where the inherited fields - can be specified runtime - even that can be changed that which entity extend what other entities. It has a great documentation and integration with Rust (and Java, and others...). I had to define how inheritance works in my entities, and ddlog could generate Rust code, which continuously evaluates the rules, and updates my program about what fields do my entities have.

  • jsonnet

    Jsonnet - The data templating language

    If I understand what you are asking correctly you could use a configuration language like Jsonnet to accomplish what you want. It would allow you to define base definitions that can be merged to whatever depth you need.

  • OPS

    OPS - Build and Run Open Source Unikernels. Quickly and easily build and deploy open source unikernels in tens of seconds. Deploy in any language to any cloud.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts