The stumbling blocks of static extraction in ReScript:
- PPX has access only to code AST it wraps, nothing else
- PPX can't emit side effects
In the current state of things, I see no way to implement static extraction with PPX-only. But it can be split in 2 steps:
- ReScript part: PPX parses CSS and generates sound CSS functions
- Bundler: parses generated JS from ReScript and transforms CSS functions generated by PPX back into static CSS. Output is: classnames in
.js + CSS code in .css.
Basically, step 2 is reimplementation of Linaria but for ReScript.
It's a lot of work.
The stumbling blocks of static extraction in ReScript:
In the current state of things, I see no way to implement static extraction with PPX-only. But it can be split in 2 steps:
.js+ CSS code in.css.Basically, step 2 is reimplementation of Linaria but for ReScript.
It's a lot of work.