Use design tokens to store brand colors, font families, class lists, or any other reusable value from your design system that gets used across multiple teams or applications. Crucial for design systems and essential for small design teams that need to manage consistency across multiple dev teams.
This workflow approach is a simple example of how to easily integrate design tokens into your project simply using Gulp. This is a really easy task to accomplish that no one talks about (and one that you'll find almost zero documentation on how-to accomplish it in a real world project).
To illustrate the power of design tokens, the .json
files in the design-tokens
directory are organized into some common modules. When you run gulpfile.js
, it:
- merges all the design token
.json
files into one - outputs the merge
.json
file (this is your single-source-of-truth-file all teams would consume) into the root of the project - converts the merged
.json
file into a.scss
file that gets dumped into yourscss
partials (never commit this file) - compiles all your
.scss
files (I'm pulling in Tachyons for my example) - loads the
.json
tokens file into gulp'sdata
object which makes your tokens available to your templating system (I use Nunjucks because it's the best JS templating language out there) - puts it all together and outputs a simple
HTML
template that relies on some of the token values
- Run
npm install
- Run
npm run build
orgulp build
to start up the project - Move around directories and files as needed (just make sure to update paths where necessary)
Hit me up on twitter: @mindsculpt