Skip to content

Make React.Dom.Style.make more bundle size friendly #112

@jchavarri

Description

@jchavarri

Right now, every call to React.Dom.Style.make is compiled to a bunch of zeros on unused optional arguments.

This leads quickly to larger bundle sizes, e.g. for 7 usages of this function in some real world project, a prod bundle increases by ~17KB.

We should provide an API where the style properties are passed in a list, so unused ones don't lead into bundle costs.

e.g. like @davesnx does in jsoo-css:

  let box =
    React.Dom.Style.make([|
      color("333"),
      backgroundColor("C0FFEE"),
      padding("45px"),
      borderRadius("8px"),
      fontSize("22px"),
      fontWeight("bold"),
    |]);

I don't think we need type safety on each prop type, for a first version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions