Specify Docs
Specify ↗︎Changelog ↗︎Guide ↗︎
V2
V2
  • Getting started
    • Introduction
    • What is Specify?
    • Pulling your first tokens with the CLI
    • Glossary
  • Collect
    • What is a Source?
    • Available sources
      • Figma Variables & Styles
      • Tokens Studio
  • Distribute
    • What is a Destination?
    • Available destinations
      • GitHub
      • Specify CLI
      • Specify SDK
      • HTTP API
  • Concepts
    • Overview
    • Parsers Engine
    • SDTF Client
      • SDTF Engine
    • Specify Design Token Format
  • Guides
    • Configuration file 101
    • Specify CLI usage 101
      • Getting started
      • Authentication
      • Generate Files
    • Specify SDK usage 101
      • Getting started
      • Retrieving and working with the tokens
      • Updating tokens
      • Converting a token to XXX
      • Executing generation parsers
    • Specify SDK Cheatsheet
    • Manage font files
    • Querying a SDTF graph
  • Reference
    • Parsers Engine
    • Parsers
      • change-case
      • convert-color
      • convert-dimension
      • make-line-height-relative
      • filter
      • register-view
      • select-modes
      • prefix-by
      • suffix-by
      • replace-string
      • to-css-custom-properties
      • to-css-text-style
      • to-css-font-import
      • to-flutter
      • to-javascript
      • to-json
      • to-json-list
      • to-kotlin
      • to-react-native
      • to-scss-mixin-text-style
      • to-scss-map
      • to-sdtf
      • to-style-dictionary
      • to-swift
      • to-tailwind
      • to-typescript
      • svgo
      • svg-to-jsx
      • svg-to-tsx
      • to-svg-file
      • to-bitmap-file
      • to-file
    • Specify SDK
      • SpecifyClient
      • SDTFClient
      • Converters
        • CSS
      • ParsersEngineResults
    • SDTF Engine
      • Query API
      • Mutation API
      • SDTF Query Language
      • SDTF QueryResult
      • TokenState
        • Stateful Value
    • HTTP API
      • POST /parsers-engine-rpc
    • Specify CLI
  • Resources
    • Parser Rules templates
      • CSS Custom Properties
      • Tailwind
      • React Native
      • Flutter
      • SDTF
      • JSON
    • Specify CLI VS Specify SDK
    • Playground
    • Best practices
  • Useful links
    • Discord
    • YouTube
    • Twitter
    • Help Center
    • Canny
Powered by GitBook
On this page
  • Interface
  • Options
  • Basic usage

Was this helpful?

Export as PDF
  1. Reference
  2. Parsers

to-scss-mixin-text-style

This parser helps you generate text styles as SCSS mixins.

Interface

interface parser {
  name: 'to-scss-mixin-text-style';
  output: {
    type: 'file';
    filePath: string;
  };
  options?: {
    tokenNameTemplate?: string;
    exclude?: Array<
      | 'fontFamily'
      | 'fontWeight'
      | 'fontSize'
      | 'color'
      | 'fontFeatures'
      | 'lineHeight'
      | 'letterSpacing'
      | 'paragraphSpacing'
      | 'textAlignHorizontal'
      | 'textAlignVertical'
      | 'textDecoration'
      | 'textIndent'
      | 'textTransform'
    >;
    include?: Array<
      | 'fontFamily'
      | 'fontWeight'
      | 'fontSize'
      | 'color'
      | 'fontFeatures'
      | 'lineHeight'
      | 'letterSpacing'
      | 'paragraphSpacing'
      | 'textAlignHorizontal'
      | 'textAlignVertical'
      | 'textDecoration'
      | 'textIndent'
      | 'textTransform'
    >;
    genericFamily?: string;
  };
}

Options

Parameter
Required
Type
Default
Description

tokenNameTemplate

false

string

{{path}}-{{token}}-{{mode}}

The template the parser follows to name your tokens. You can use the path of your tokens, their token name, and their respective mode.

exclude

false

Array<string>

List of properties to exclude in the SCSS mixins

include

false

Array<string>

List of properties to include in the SCSS mixins

genericFamily

false

string

The generic font family will be applied after the main font family

Basic usage

{
  "Text styles": {
    "Body": {
      "$type": "textStyle",
      "$value": {
        "default": {
          "font": {
            "family": "Neue Haas Grotesk Text Pro",
            "postScriptName": "Neue Haas Grotesk Text Pro",
            "weight": "roman",
            "style": "normal",
            "files": []
          },
          "fontSize": {
            "value": 14,
            "unit": "px"
          },
          "color": null,
          "fontFeatures": null,
          "lineHeight": {
            "value": 21,
            "unit": "px"
          },
          "letterSpacing": {
            "value": 0.2,
            "unit": "px"
          },
          "paragraphSpacing": {
            "value": 0,
            "unit": "px"
          },
          "textAlignHorizontal": null,
          "textAlignVertical": null,
          "textDecoration": "none",
          "textIndent": {
            "value": 0,
            "unit": "px"
          },
          "textTransform": "none"
        }
      },
      "$extensions": {
        "com.specifyapp.figmaStyles.hangingList": false,
        "com.specifyapp.figmaStyles.leadingTrim": "NONE",
        "com.specifyapp.figmaStyles.listSpacing": 0,
        "com.specifyapp.figmaStyles.hangingPunctuation": false
      }
    },
    "Body-lg": {
      "$type": "textStyle",
      "$value": {
        "default": {
          "font": {
            "family": "Neue Haas Grotesk Text Pro",
            "postScriptName": "Neue Haas Grotesk Text Pro",
            "weight": "roman",
            "style": "normal",
            "files": []
          },
          "fontSize": {
            "value": 16,
            "unit": "px"
          },
          "color": null,
          "fontFeatures": null,
          "lineHeight": {
            "value": 150,
            "unit": "%"
          },
          "letterSpacing": {
            "value": 0.4,
            "unit": "px"
          },
          "paragraphSpacing": {
            "value": 0,
            "unit": "px"
          },
          "textAlignHorizontal": null,
          "textAlignVertical": null,
          "textDecoration": "none",
          "textIndent": {
            "value": 0,
            "unit": "px"
          },
          "textTransform": "none"
        }
      },
      "$extensions": {
        "com.specifyapp.figmaStyles.hangingList": false,
        "com.specifyapp.figmaStyles.leadingTrim": "NONE",
        "com.specifyapp.figmaStyles.listSpacing": 0,
        "com.specifyapp.figmaStyles.hangingPunctuation": false
      }
    },
    "Body-sm": {
      "$type": "textStyle",
      "$value": {
        "default": {
          "font": {
            "family": "Neue Haas Grotesk Text Pro",
            "postScriptName": "Neue Haas Grotesk Text Pro",
            "weight": "roman",
            "style": "normal",
            "files": []
          },
          "fontSize": {
            "value": 12,
            "unit": "px"
          },
          "color": null,
          "fontFeatures": null,
          "lineHeight": {
            "value": 150,
            "unit": "%"
          },
          "letterSpacing": {
            "value": 0.2,
            "unit": "px"
          },
          "paragraphSpacing": {
            "value": 0,
            "unit": "px"
          },
          "textAlignHorizontal": null,
          "textAlignVertical": null,
          "textDecoration": "none",
          "textIndent": {
            "value": 0,
            "unit": "px"
          },
          "textTransform": "none"
        }
      },
      "$extensions": {
        "com.specifyapp.figmaStyles.hangingList": false,
        "com.specifyapp.figmaStyles.leadingTrim": "NONE",
        "com.specifyapp.figmaStyles.listSpacing": 0,
        "com.specifyapp.figmaStyles.hangingPunctuation": false
      }
    }
  }
}
.specifyrc.json
{
  "version": "2",
  "repository": "@organization/repository",
  // Only use the personalAccessToken when working with the CLI
  "personalAccessToken": "<your-personal-access-token>",
  "rules": [
    {
      "name": "to-scss-mixin-text-style",
      "output": {
        "type": "file",
        "filePath": "public/text-styles.scss"
      },
      "options": {
        "genericFamily": "sans-serif"
      }
    }
  ]
}
public/text-styles.scss
@mixin Text-styles-Body {
	font-family: Neue Haas Grotesk Text Pro, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	letter-spacing: 0.2px;
	font-weight: roman;
}
@mixin Text-styles-Body-lg {
	font-family: Neue Haas Grotesk Text Pro, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	letter-spacing: 0.4px;
	font-weight: roman;
}
@mixin Text-styles-Body-sm {
	font-family: Neue Haas Grotesk Text Pro, sans-serif;
	font-size: 12px;
	line-height: 1.5;
	letter-spacing: 0.2px;
	font-weight: roman;
}
Previousto-react-nativeNextto-scss-map

Last updated 11 months ago

Was this helpful?