0.1.1 • Published 2 years ago

@integratedexperts/scss-variables-extractor v0.1.1

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

SCSS variables extractor

Extract SCSS variables to make them available in scripts using vanilla JS.

Build

Usage

const extractor = require('./scss-variables-extractor');

// SCSS content.
const content = `
    $theme-colors-brands-default: (
      'light': (
        'brand1': #123456,
        'brand2': #234567,
        'brand3': #345678,
      ),
      'dark': (
        'brand1': #987654,
        'brand2': #876543,
        'brand3': #765432,
      )
    );
`;

const vars = extractor.extract(content);

console.log(vars);

// Output:
// {
//   'theme-colors-brands-default': {
//     'light': {
//       'brand1': '#123456',
//       'brand2': '#234567',
//       'brand3': '#345678',
//     },
//     'dark': {
//       'brand1': '#987654',
//       'brand2': '#876543',
//       'brand3': '#765432',
//     }
//   }
// }