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

Make sure normalizeCSSVarsValue runs for more cases #21

Closed
Zn4rK opened this issue Nov 14, 2023 · 2 comments · Fixed by #25
Closed

Make sure normalizeCSSVarsValue runs for more cases #21

Zn4rK opened this issue Nov 14, 2023 · 2 comments · Fixed by #25
Labels
bug Something isn't working engine Navita CSS rendering engine good first issue Good for newcomers

Comments

@Zn4rK
Copy link
Contributor

Zn4rK commented Nov 14, 2023

const color = createVar('color');

const x = style({
   background: `rgba(${color}, 0.15)`,
});

Will produce this css:

.a1 {
   background: rgba(--color, 0.15);
}

Instead of this:

.a1 {
   background: rgba(var(--color), 0.15);
}

Source:
https://github.com/eagerpatch/navita/blob/main/packages/engine/src/helpers/normalizeCSSVarsValue.ts#L3

At first glance, it looks like the regex is still valid, but we need to expand the test cases, and modify or remove the if-statement that decides if we should normalize CSS var values.

@Zn4rK Zn4rK added bug Something isn't working good first issue Good for newcomers engine Navita CSS rendering engine labels Nov 14, 2023
@vinayakhegde1
Copy link

@Zn4rK Although I'm just a beginner. I would like to work on this but I don't have rust on my system do I need to install it? also how do i run this on my local machine if there are any contributing guidelines do let me know :)

@Zn4rK
Copy link
Contributor Author

Zn4rK commented Nov 15, 2023

Hello @vinayakhegde1! Nice! You should for sure try!

To build the whole project, you'll need to have rust installed. But the @navita/engine does not require the rust package.

Right now, to not have to install the rust package, while still maintaining the correct relationship between the packages, would be to potentially use a .pnpmfile.cjs:

module.exports = {
  hooks: {
    readPackage(packageJson) {
      if (packageJson.name === '@navita/swc') {
        packageJson.version = 'latest';
      }
      return packageJson;
    },
  },
};

(This will affect the lock file incorrectly though, so dependencies would need to be re-installed before publishing, but you should be able to run it locally without having to install rust)

I'll try to compose some contributing guidelines later this week, and also think about ways to contribute without having to install rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working engine Navita CSS rendering engine good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants