Socket
Socket
Sign inDemoInstall

@maibornwolff/mwui-token-farm

Package Overview
Dependencies
5
Maintainers
8
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @maibornwolff/mwui-token-farm

Transforms figma design tokens to common config files serving different styling frameworks


Version published
Maintainers
8
Created

Readme

Source
token-farm

The Liberation Machine - Token Farm

npm

The Token Farm houses the exported tokens from the Figma design file and converts them into variables for our Stencil component library. It's based on token-transformer package and Style Dictionary.

Structure

input contains the raw json output files from the Figma design file. src cointains the script which turns these files into usable variables, which are generated in dist.

Output types

The Token Farm can be configured to output various different file types, such as JavaScript, TypeScript, json, css and scss in build.ts. It can also create several output files for different themes.

Workflow

The main-build.yml workflow executes the Token Farm script whenever a commit is pushed to the main branch. Afterwards the Stencil component library is rebuilt with the new tokens and the Storybook is updated.

Using the tokens in the Stencil Library

To use the exported tokens, add the following line to a component:

import { tokenName } from '../../../mwui-token-farm/dist/js/global';

You can then reference the tokens using Emotion, a CSS-in-JS package.

import { css } from '@emotion/css';

const componentStyle = css`
  css-attribute: ${tokenName};
`;

...

export class MwComponent {
  render() {
    return (
      <div class={componentStyle}></div>
    );
  }
}

FAQs

Last updated on 05 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc