pydsigner / python-lightningcss

Opinionated Python bindings for lightningcss.
https://pypi.org/project/lightningcss/
Apache License 2.0
4 stars 2 forks source link

Expose custom transforms visitor API #1

Open pydsigner opened 1 year ago

pydsigner commented 1 year ago

The JavaScript bindings for lightningcss expose a powerful API for transforming CSS: https://lightningcss.dev/transforms.html. This functionality would be valuable, especially for projects like https://github.com/pydsigner/anchovy_css.

pydsigner commented 1 year ago

https://docs.rs/lightningcss/1.0.0-alpha.44/lightningcss/visitor/index.html

The basis of our implementation should be a PyVisitor struct. This will have to wrap a RustVisitor struct that implements lightningcss::visitor::Visitor; Visitor itself involves lifetime parameters, which must be abstracted away from PyO3 (https://pyo3.rs/v0.19.2/class#no-lifetime-parameters).