Giter VIP home page Giter VIP logo

exporter-style-dictionary's Introduction

Supernova Logo

Supernova is a design system platform that manages your assets, tokens, components and allows you to write spectacular documentations for your entire teams. And because you found your way here, you are probably interested in its most advanced functionality - automatic hand-off of design and development assets, tokens and data in general. To learn everything Supernova, please check out our developer documentation.

Style Dictionary Exporter

The Style Dictionary Exporter allows you to convert Supernova tokens and styles into style dictionary format, so you can use them in your pipeline, if you don't want to switch to other exporters provided by Supernova. You can generate Style Dictionary definitions either manually - on demand - using Supernova's VS Code extension, or automate your code delivery pipeline using Supernova Design Continuous Delivery.

Example Usage

Once you have run the exporter against your design system, you can start using the code in your codebase right away. Exporter creates the following definitions:

  • colors.json containing all colors tokens
  • fonts.json containing all font tokens
  • gradients.json containing all gradient tokens
  • measures.json containing all measure tokens
  • radii.json containin all radius tokens
  • shadows.json containing all shadow tokens
  • text.json containing all semantic labels
  • typography.json containing all typography classes

Each of the .json files can be used inside style dictionary. The exporter properly follows the structuring of the tokens inside respective categories, adding groups as nesting inside the definition:

{
  "color": {
    "ui-elements": {
      "primary": {
        "value": "#4589ffff",
        "type": "color"
      },
      "success": {
        "value": "#00a454ff",
        "type": "color"
      },
      "critical": {
        "value": "#d23031ff",
        "type": "color"
      }
   }
}

In this case, critical token was defined inside Colors category, in success group. Of course, the exporter also properly exports references when you used token aliasing inside Supernova:


{
  "color": {
    "ui-elements": {
      "primary": {
        "value": "#4589ffff",
        "type": "color"
      },
      "primary-copy": {
        "value": "{color.ui-elements.primary.value}",
        "type": "color"
      },
   }
}

Finally, if you are tokens using mixins - such as using measure tokens inside typography, the exporter draws from those as well and will properly export all references, even across different definition trees. This way, everything you defined in Supernova is always exported.

Comments & Descriptions

If you are using token descriptions, the exporter includes them under comment key:

{
  "text": {
    "welcome-screen": {
      "sign-in": {
        "value": "Please Sign In",
        "type": "text",
        "comment": "Use this everywhere user creates a new account"
      },
      "sign-out": {
        "value": "Sign Out from the application",
        "type": "text"
      },
      "forgot-password": {
        "value": "Did you forget your password?",
        "type": "text"
      }
    }
  }
}

Multi-line descriptions are also supported, and will be exported with \n where newline occurs. If the token doesn't have a description, the comment key is not generated.

Installing

In order to make the Supernova Style Dictionary exporter available for your organization so you can start generating code from your design system, please follow the installation guide in our developer documentation.

Reporting Bugs or Requesting Features

In order to faciliate easy communication and speed up delivery of fixes and features for this exporter, we require everyone to log all issues and feature requests through the issue tracking of this repository.

Please read through the existing issues before you open a new issue! It might be that we have already discussed it before. If you are sure your request wasn't mentioned just yet, proceed to open a new issue and fill in the required information. Thank you!

Contributing

If you have an idea for improving this exporter package or want a specific issue fixed quickly, we would love to see you contribute to its development!

There are multiple ways you can contribute, so we have written a contribution guide that will walk your through the process. Any pull requests to this repository are very welcome.

Would love to help us build more but maybe need a little bit of support? Join our community and drop us a message, we will support any of your wild ideas!

License

This exporter is distributed under the MIT license. We absolutely encourage you to clone it and modify it for your purposes, so it fits the requirements of your stack. If you see that you have created something amazing in the process that others would benefit from, we strongly recommend you consider publishing it back to the community as well.

Useful Links

  • To learn more about Supernova, go visit our website
  • To join our community of fellow developers where we try to push what is possible with design systems and code automation, join our community discord
  • To understand everything you can do with Supernova and how much time and resources it can save you, go read our product documentation
  • Finally, to learn everything about what exporters are and how you can integrate with your codebase, go read our developer documentation

Supernova Maintained Exporters

We are developing and maintaining exporters for many major technologies. Here are all the official exporters maintained by Supernova:

Additionally, you can also use asset exporters for all major targets, enjoy!:

To browse all exporters created by our amazing community, please visit the Supernova Exporter Store.

exporter-style-dictionary's People

Contributors

jiritrecak avatar artufimtcev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.