Skip to content

Latest commit

 

History

History
83 lines (63 loc) · 2.26 KB

README.md

File metadata and controls

83 lines (63 loc) · 2.26 KB

Yourproject logo

SCSS variables extractor

GitHub Issues GitHub Pull Requests Test GitHub release (latest by date) LICENSE Renovate


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

Features

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

Installation

npm install @alexskrypnyk/scss-variables-extractor

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',
//     }
//   }
// }

Maintenance

npm install
npm lint
npm test

Repository created using https://getscaffold.dev/ project scaffold template