JSPM

  • Created
  • Published
  • Downloads 2581
  • Score
    100M100P100Q115449F
  • License MIT

Schemas and tools for managing design tokens

Package Exports

  • @cobalt-ui/core
  • @cobalt-ui/core/dist/index.js
  • @cobalt-ui/core/dist/index.min.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@cobalt-ui/core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@cobalt-ui/core

JS-only tool to parse a tokens.json schema, validate it for errors, and return tokens as a normalized, flattened array. Works both in Node and the browser!

For building tokens and syncing with Figma, use @cobalt-ui/cli.

Install

npm install @cobalt-ui/core

Usage

This

Parse a tokens.json file into a JS object

import co from '@cobalt-ui/core';
import fs from 'fs';

const { errors, warnings, result } = JSON.parse(co.parse(fs.readFileSync('./tokens.json', 'utf8')));