Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thoughts on how to make CSS extraction safe #2

Open
alex35mil opened this issue Nov 23, 2020 · 0 comments
Open

Thoughts on how to make CSS extraction safe #2

alex35mil opened this issue Nov 23, 2020 · 0 comments

Comments

@alex35mil
Copy link
Member

alex35mil commented Nov 23, 2020

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:

  1. ReScript part: PPX parses CSS and generates sound CSS functions
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant