Socket
Socket
Sign inDemoInstall

kubas

Package Overview
Dependencies
27
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    kubas

A design token and utility class generator


Version published
Weekly downloads
9
Maintainers
1
Install size
12.8 MB
Created
Weekly downloads
 

Readme

Source

Kubas

Kubas takes design tokens and generates CSS Custom Properties and Utility Classes for them. The output is 2 CSS files, tokens.css and utilities.css.

The name is the Lithuanian translation of Cube - CUBE CSS is a term coined by Andy Bell and the idea behind it inspired this tool. He also has a similar tool called Goron which is probably better than this, but I wanted to build something :)

Installation

npm install kubas --save

Defining Tokens

Config can be done in JSON or JS. Create a kubas.json or kubas.config.js in your project directory. If you choose JS, it'll need to export an object containing your config.

By default, the outputDir key is set to dist, so set this to suit your project.

Your config should contain 2 objects, one to define your tokens and another to map those tokens to utilities. In the example below, we color tokens, which are mapped to c-* utility classes, which will set color to each of the available color tokens.

module.exports = {
    outputDir: 'src/css',
    tokens: {
        color: {
            black: '#000',
            white: '#fff',
        },
    },
    utilities: {
        color: {
            c: 'color',
        },
    },
};

There's no support for breakpoints at the moment and I don't know if there ever will be. That sorta defeats the idea of the simplistic nature of CUBE CSS.

Generate CSS

Run Kubas from your command line. To use the kubas alias, you'll need to install Kubas globally. (npm install kubas -g)

kubas

Roadmap

  • Write tests
  • Add support for utility classes that aren't mapped directly to tokens

FAQs

Last updated on 02 Jun 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc