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

Setting up design-tokens from style-dictionary #207

Merged
merged 6 commits into from
Jun 1, 2022

Conversation

sergei-maertens
Copy link
Member

Related to open-formulieren/open-forms#1603

This PR moves (some of the) CSS variables to a dedicated design-tokens repository and integrates it in our build/development toolchain.

The design-tokens repository is included as git submodule so we have a consistent and predictable path. This lets us use yarn workspaces (npm has them too) which automatically deals with the yarn link behaviour for local development, letting us use the local source code as if it was a package installed from npm. Changes in the resulting stylesheet are picked up by webpack, which re-compiles when needed.

The build and start scripts also ensure that a build of the submodule is created so that the resulting CSS files can be included.

TODO

  • Use the index.css with theme class name rather than root.css which emits tokens under the :root {...} pseudo-selector
  • Find a way to publish the package with workspaces. Using workspaces with yarn requires private: true, which prevents us from building and publishing the package to npm. This may actually be a good thing so we properly divide the src up into local-development tooling vs. what is actually needed in production - we now switch entrypoints between index.js and sdk.js instead.

@sergei-maertens
Copy link
Member Author

Submodules in CI are a bit annoying it seems, applying https://stackoverflow.com/a/50299434 now

@sergei-maertens sergei-maertens force-pushed the feature/1603-style-dict branch 2 times, most recently from 2d244c4 to 22e33d6 Compare May 30, 2022 14:06
@sergei-maertens sergei-maertens force-pushed the feature/1603-style-dict branch from 22e33d6 to 084a169 Compare May 30, 2022 14:07
@sergei-maertens sergei-maertens marked this pull request as draft May 30, 2022 14:36
@sergei-maertens
Copy link
Member Author

The multiple nesting levels are really problematic - style-dict merges everything together and then stops at the first level where a value is detected. See also amzn/style-dictionary#366

This requires you to take great care in naming your design tokens and structuring them!

@sergei-maertens sergei-maertens marked this pull request as ready for review May 30, 2022 15:42
@sergei-maertens sergei-maertens merged commit 0928533 into main Jun 1, 2022
@sergei-maertens sergei-maertens deleted the feature/1603-style-dict branch June 1, 2022 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants