Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@cobalt-ui/plugin-sass

drwpow830MIT1.8.1TypeScript support: included

Generate scss/sass from your design tokens schema (requires @cobalt-ui/cli)

cobalt, design tokens, design tokens community group, design system, dtcg, w3c, css, sass

readme

@cobalt-ui/plugin-sass

Generate .scss and .sass from your Design Tokens Community Group (DTCG) tokens.

Features

  • ✅ Supports all features of the CSS plugin
  • ✅ Strong typechecking with Sass to never have broken styles

Setup

Install the plugin (and its dependency) from npm:

npm i -D @cobalt-ui/plugin-sass @cobalt-ui/plugin-css

Then add to your tokens.config.mjs file:

// tokens.config.mjs
import pluginSass from "@cobalt-ui/plugin-sass";

/** @type {import("@cobalt-ui/core").Config} */
export default {
  tokens: "./tokens.json",
  outDir: "./tokens/",
  plugins: [pluginSass()],
};

And run:

npx co build

You’ll then generate a ./tokens/index.scss file that exports a token() function you can use to grab tokens:

@use "../tokens" as *; // update "../tokens" to match your location of tokens/index.scss

.heading {
  color: token("color.blue");
  font-size: token("typography.size.xxl");
}

Docs

View the full documentation

changelog

@cobalt-ui/plugin-sass

1.8.1

Patch Changes

1.8.0

Minor Changes

Patch Changes

2.0.0

Patch Changes

1.3.3

Patch Changes

1.3.2

Patch Changes

1.3.2

Patch Changes

1.3.1

Patch Changes

1.3.0

Minor Changes

Patch Changes

1.2.5

Patch Changes

1.2.4

Patch Changes

1.2.3

Patch Changes

1.2.2

Patch Changes

1.2.1

Patch Changes

1.2.0

Minor Changes

  • 526777f: Add fontFamily, fontWeight, fontName, and number types, remove font type

Patch Changes

1.1.4

Patch Changes

1.1.3

Patch Changes

1.1.2

Patch Changes

1.1.1

Patch Changes

1.1.0

Minor Changes

  • 9edc9d9: Add option to resolve token() to vars generated by @cobalt-ui/plugin-css

Patch Changes

1.0.0

Minor Changes

  • e50c864: Add strokeStyle and border support in plugins, improve validation in core

Patch Changes

0.7.2

Patch Changes

0.7.1

Patch Changes

0.7.0

Minor Changes

  • 9e80004: Breaking change: improve and normalize transform API

Patch Changes

0.6.2

Patch Changes

  • ed21d56: Bump deps, add config type to docs
  • Updated dependencies [a2a9d62]
  • Updated dependencies [ed21d56]

0.6.1

Patch Changes

  • cd82302: Fix listModes bug

0.6.0

Minor Changes

  • 6bd3b9b: Add listModes() function

0.5.0

Minor Changes

  • 07bc365: Update to Feb 2022 version of the Design Tokens format

0.4.9

Patch Changes

  • Bugfix: typography mixin

0.4.8

Patch Changes

  • c263337: Fix typography map

0.4.7

Patch Changes

  • Update core

0.4.6

Patch Changes

0.4.5

Patch Changes

  • 93668b9: Fix gradient generation

0.4.4

Patch Changes

  • 8f5025d: Update package description

0.4.3

Patch Changes

  • Bump deps

0.4.2

Patch Changes

  • 1170d8b: Add metadata.name to comment
  • 1170d8b: Fix bug where shadow type tokens had commas in the wrong places

0.4.1

Patch Changes

  • 4061584: Add autogenerated message to CSS & Sass

0.4.0

Minor Changes

  • 55e82ca: Breaking change: use token() function instead of Sass variables

0.3.2

Patch Changes

  • 395e388: Fix mode map keys

0.3.1

Patch Changes

  • 44452f7: Fix default token handling

0.3.0

Minor Changes

  • 8d05fe8: Add Figma sync, make some breaking API changes

Patch Changes

0.2.1

Patch Changes

  • 6feabd5: Fix SVG embedding

0.2.0

Minor Changes

  • 26bfb4c: Convert to JSON, follow design tokens spec

Patch Changes

0.1.0

Minor Changes

  • 5748e72: Use JSON to align with the Design Tokens W3C spec

Patch Changes