Skip to content

Supernova Android exporter that allows conversion of design system data and elements into valid, production-ready XML definitions and Kotlin code

License

Notifications You must be signed in to change notification settings

brandonsupernova/exporter-android

 
 

Repository files navigation

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

Android Exporter

The Android exporter allows you to produce production-ready code for all product styles (such as colors) defined inside your design system in such a way that you can immediately use them to style your application elements. Specifically, this exporter automates the coding of:

  • Color definitions
  • Text Styles
  • Fonts
  • Radii
  • Measures

The exporter will generate a file per style type. Here's an example of the exporter ouput for a single 11 Regular Italic text style:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="_11RegularItalic">
        <item name="android:textSize">11sp</item>
        <item name="android:letterSpacing">0.3</item>
        <item name="android:fontFamily">@font/roboto_regular</item>
        <item name="android:textStyle">normal</item>
    </style>

</resources>

A corresponding font/roboto.xml file will be created:

<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">  

    <font
        app:fontStyle="normal"
        app:fontWeight="400"
        app:font="@font/roboto_regular" />

</font-family>    

Note: exporter doesn't provide required font files (.ttf, .otf). Please, download all necessary font files from your Design System Management system or Google Fonts service. After that, name them accordingly and put next to the corresponding font XML files.

For example above, a Roboto Regular font needs to be downloaded from https://fonts.google.com/, named as roboto_regular.ttf and placed next to font/roboto.xml file.

You can generate all production ready-code either manually 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. Here are a few examples of how you can use the output of the Android exporter:

Using a text style

<TextView
    style="@style/_11RegularItalic"
    android:id="@+id/text_home"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:layout_marginEnd="8dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

Installing

In order to make the Supernova Android 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.

About

Supernova Android exporter that allows conversion of design system data and elements into valid, production-ready XML definitions and Kotlin code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%