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

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

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • grass

    A 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

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • 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

    Discontinued (朽木) 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.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

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