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

implement Figma design tokens #94

Merged
merged 21 commits into from
May 4, 2023
Merged

implement Figma design tokens #94

merged 21 commits into from
May 4, 2023

Conversation

sifferhans
Copy link
Collaborator

@sifferhans sifferhans commented Apr 23, 2023

Figma -> Tailwind

I have set up a transformation pipeline for converting Figma design tokens to a Tailwind config, based on what has been done by Laurens in the BCC Design Tokens repo.

By running the pnpm tokens:build command, the tokens in /assets/design-tokens/tokens.json will be transformed and written to separate files in the /tailwind directory.
I only converted colors for now, as the typography tokens are quite difficult to convert to a Tailwind style config.

Changing classes

I also changed every color class to the new BMM classes.
Eg. everywhere we used the bg-slate-100 class is now using the bg-background-2 class.

The names of the classes are derived from the naming in the Figma file:

  • Figma -> light/background/2
  • Tailwind -> bg-background-2

@sifferhans sifferhans marked this pull request as ready for review April 23, 2023 13:45
@sifferhans sifferhans mentioned this pull request Apr 23, 2023
@sifferhans sifferhans linked an issue Apr 23, 2023 that may be closed by this pull request
.vscode/settings.json Outdated Show resolved Hide resolved
@sifferhans sifferhans mentioned this pull request Apr 26, 2023
@SimonSimCity
Copy link
Collaborator

By running the pnpm tokens:build command, the tokens in /assets/design-tokens/tokens.json will be transformed and written to separate files in the /tailwind directory.

Wouldn't it then make sense to ignore the folder at least for both prettier, eslint and git? Maybe even turn this into a Nuxt package, where we can have the generated css files in a temporary directory and import them automagically 😎

@kkuepper
Copy link
Member

kkuepper commented Apr 28, 2023

I don't think a nuxt package makes sense (at least if it's similar to a npm package). It would lead to only 1 or 2 people knowing how to update it.
Comment doesn't make much sense, since I misunderstood.

@sifferhans
Copy link
Collaborator Author

@kkuepper I think Simon is thinking about a Nuxt module, which would be local in the repo in this case 😊

# Conflicts:
#	components/ContentSection.vue
#	components/DropdownMenu.vue
#	components/MediaPlayer.vue
#	components/sidebar/SidebarItem.vue
#	pnpm-lock.yaml
@sifferhans
Copy link
Collaborator Author

I haven't had the time to work on this the last week. @SimonSimCity Did you have any ideas on how to improve things? If you have, feel free to try it

@SimonSimCity
Copy link
Collaborator

Removed the tailwind directory and instead replace the tailwind.config.ts by a generated file. This has the advantage, that whenever /assets/design-tokens/tokens.json is updated, it triggers a custom module which writes a new tailwind.config.ts. This in turn will autoreload all modules watching on a change on this file.

Having generated imports from within ./tailwind isn't sufficient because it requires a developer to rerun pnpm dev when a style is changed, which defeats the approach of nuxt (run dev and everything will automagically update).

@kkuepper kkuepper merged commit 4454d68 into main May 4, 2023
@SimonSimCity SimonSimCity deleted the feature/design-tokens branch May 4, 2023 12:40
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.

Add BMM design tokens to tailwind config
3 participants