JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 60
  • Score
    100M100P100Q60785F
  • License MIT

README

Package Exports

  • theme-builder

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (theme-builder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Theme builder

npm Build Status Coverage NSP Status

Build theme's variables form YAML to consumable format (like JS or SCSS)

Installing

npm install theme-builder

How to use

const themeBuilder = require('theme-builder');
const themeYaml = fs.readFileSync(pathToYamlFile);
const themeScss = themeBuilder(themeYaml, 'scss');

Current formats

  • js - just a plain javascript object
  • scss - SCSS variables

How it works (example)

You have index.yaml and you want to convert it to SCSS:

generic:
  color:
    accent: &accent '#1fcff6'
button:
  color:
    bg: *accent

So, you can call themeBuilder function like this:

const themeYaml = fs.readFileSync('index.yaml');
themeBuilder(themeYaml, 'scss', {prefix: 'ui'});

and as result you will get string with 2 variables:

$ui-generic-color-accent: #1fcff6;
$ui-button-color-bg: #1fcff6;

You can save the output to .scss file and use while writing your styles.