Skip to content

Thoughts on how to make CSS extraction safe #2

Description

@alex35mil

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions