项目作者: afeiship

项目描述 :
Deep get for sass-loader based node-sass.
高级语言: JavaScript
项目地址: git://github.com/afeiship/next-sass-get.git
创建时间: 2019-03-02T03:16:47Z
项目社区:https://github.com/afeiship/next-sass-get

开源协议:MIT License

下载


next-sass-get

Deep get for sass-loader based node-sass.

@jswork/next-sass-get"">version
license
size
@jswork/next-sass-get"">download

installation

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

apis

api params description
get - desc balabala

usage

  1. import NxSassGet from '@jswork/next-sass-get';
  2. // code goes here:
  3. const cssResult = sass.renderSync({
  4. data: sassString,
  5. options: {
  6. outputStyle: 'expanded'
  7. },
  8. functions: NxSassGet.create({
  9. color: {
  10. primary: {
  11. default: '#4cd964',
  12. dark: '#f60',
  13. light: '#eee'
  14. },
  15. secondary: '#999'
  16. }
  17. })
  18. });

input

  1. $colors: (
  2. f: #fff,
  3. e: #eee,
  4. 0: #000,
  5. 3: #333,
  6. 6: #666,
  7. 8: #888,
  8. 9: #999,
  9. primary: get("color.primary.default"),
  10. secondary: get("color.secondary")
  11. );
  12. .color1 {
  13. color: map-get($colors, primary);
  14. }
  15. .color2 {
  16. background: get("color.secondary");
  17. }

output

  1. .color1 {
  2. color: #4cd964; }
  3. .color2 {
  4. background: #999; }

license

Code released under the MIT license.