In my projects I’m using CSS Modules. Currently I’m doing the following:
type css = {. "foo": string};
[@bs.module] external css: css = "./Foo.css";
This works as intended and allows me to assign generated class names to components.
I’d like to write a PPX to automate the process:
let css = [%import_css "./Foo.css"]
The PPX would parse the CSS file to extract the classes (in a similar fashion to how the original CSS modules does) and emit something like what I’m currently writing.
Is this possible to do? Has something similar already been done? I didn’t manage to find anything myself. Is a PPX the right tool for this?