This package has been deprecated

Author message:

Please migrate to @cobalt-ui/plugin-js

@cobalt-ui/plugin-ts
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

@cobalt-ui/plugin-ts

Generate TypeScript output from design tokens.

npm i -D @cobalt-ui/plugin-ts
// tokens.config.mjs
import ts from '@cobalt-ui/plugin-ts';
import better from 'better-color-tools';

/** @type import('@cobalt-ui/core').Config */
export default {
  plugins: [
    ts({
      /** set the filename inside outDir */
      filename: './index.ts',
      /** modify values */
      transform(token, mode) {
        // convert colors to P3
        switch (token.$type) {
          case 'color': {
            return better.from(token.$value).p3;
          }
        }
      },
    }),
  ],
};

Readme

Keywords

none

Package Sidebar

Install

npm i @cobalt-ui/plugin-ts

Weekly Downloads

0

Version

0.5.0

License

MIT

Unpacked Size

24.8 kB

Total Files

13

Last publish

Collaborators

  • drewpowers