Replies: 1 comment
-
This is intentional design decision of how the compiler works and this rule has been documented:
Namely:
This design is important to make the compilation of individual files cacheable. The design makes it possible to compile each file without ever reading another file. See the
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When working with styleX, I keep running into the same problem. As long as I import the files where the stylex variables are defined directly into the .ts file with the component, everything works fine.
colors.stylex.ts
myComponentStyle.tsx
myComponent.tsx
But what if I want to wrap all the variables in an index file that I want to import, as we are used to, I always get the same message: Only static values are allowed inside of a stylex.create() call.
index.ts
If I name the index like index.stylex.ts, it works fine but the custom css properties that styleX generates does't contain any values.
I need to distribute styleX variables that contain design tokens from Figma in the form of an NPM package, but the actual logic of how styleX works doesn't allow me to do that, or it's not documented. Is this possible? Alternatively, how do I achieve this? @nmn The idea of using it is:
Beta Was this translation helpful? Give feedback.
All reactions