1.0.0 • Published 3 years ago

@jswork/next-sass-get v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

next-sass-get

Deep get for sass-loader based node-sass.

version license size download

installation

npm install -S @jswork/next-sass-get

apis

apiparamsdescription
get-desc balabala

usage

import NxSassGet from '@jswork/next-sass-get';

// code goes here:
const cssResult = sass.renderSync({
  data: sassString,
  options: {
    outputStyle: 'expanded'
  },
  functions: NxSassGet.create({
    color: {
      primary: {
        default: '#4cd964',
        dark: '#f60',
        light: '#eee'
      },
      secondary: '#999'
    }
  })
});

input

$colors: (
  f: #fff,
  e: #eee,
  0: #000,
  3: #333,
  6: #666,
  8: #888,
  9: #999,
  primary: get("color.primary.default"),
  secondary: get("color.secondary")
);

.color1 {
  color: map-get($colors, primary);
}

.color2 {
  background: get("color.secondary");
}

output

.color1 {
  color: #4cd964; }

.color2 {
  background: #999; }

license

Code released under the MIT license.