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

[API] Consider removing evaluation of values during build-time? #208

Open
oliviertassinari opened this issue Aug 22, 2024 · 0 comments
Open
Assignees
Labels
discussion dx Related to developers' experience performance status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 22, 2024

Summary

As far as I understand it, today, Pigment CSS works like Linaria, we evaluate the values at built-time, e.g. https://github.com/callstack/linaria?tab=readme-ov-file#syntax the font and color transformations.

import { css } from '@linaria/core';
import { modularScale, hiDPI } from 'polished';
import fonts from './fonts';

// Write your styles in `css` tag
const header = css`
  text-transform: uppercase;
  font-family: ${fonts.heading};
  font-size: ${modularScale(2)};

  ${hiDPI(1.5)} {
    font-size: ${modularScale(2.5)};
  }
`;

// Then use it as a class name
<h1 className={header}>Hello world</h1>;

This creates a very large build performance hit.

What if we were to remove this constraint? As far as I understand the value of Pigment CSS, it's about being able to CSS Modules but without having a separate file for it. When using CSS Modules, you can't import JavaScript functions so it seems that it's not that important.

Examples

Motivation

Improve build speed, simplify integration

Search keywords: -

@oliviertassinari oliviertassinari added performance status: waiting for maintainer These issues haven't been looked at yet by a maintainer dx Related to developers' experience discussion labels Aug 22, 2024
@oliviertassinari oliviertassinari changed the title [API] Consider removing evaluation of values during build-time [API] Consider removing evaluation of values during build-time? Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion dx Related to developers' experience performance status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants