0.1.12 • Published 5 years ago

masa-scss-to-json v0.1.12

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

Usage

Install the tool from npmjs.com with yarn add masa-scss-to-json.

Create a task in the scripts part of the package.json:

"scripts": {
	"scss-to-json": "masa-scss-to-json scssToJson.conf.js"
}

Add the config file:

module.exports = {
	baseDir: './scss',
	file: 'definitions',
	out: 'out.json'
}

Syntax

Supports SCSS syntax.

Variables are declared as $var: 1; Multiple declarations on a single line are supported.

Arrays are supported, they need to be declared as $arr: (1, 2, 3) (or split into multiple lines). Both trailing and leading comma syntax is supported.

Comments are supported (but ignored).

CSS-rules are supported (but ignored). Nested variables won't be included in the final result.

Variables containing other variables in their value, such as $border: $border-size solid $border-color; will be substituted.

Calculations in #{..} are supported, "flat" calculations (such as $var: $a + 1) are not.

Imports

Imports are supported. The .scss suffix is not required.

They can be relative:

  • @import "local-file";
  • @import "../lower-level-file";

They can be absolute:

  • @import "~scss-folder/file";

Default

Default values are supported. The non-default needs to occur before the declaration of default.

// branding.scss
$var: 2;

// definitions.scss
@import "branding";

$var: 1 !default;

// scssToJson.conf.js
module.exports = {
	baseDir: './',
	file: 'definitions'
}
0.1.12

5 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago