We will learn how to convert variable arguments by using rest operator in JavaScript.

.sass-btn {
color: #fff;
background-color: #0069d9;
margin: 5px;
@include button-size();
@include box-shadow(0px 4px 5px #, 2px 6px 10px #);
} @mixin box-shadow($shadows...) {
-moz-box-shadow: $shadows;
-webkit-box-shadow: $shadows;
box-shadow: $shadows;
}

Scss "$shadows..." the same as "...shadows" in Javascript.

export const boxShadow = (...shadows) => `
-moz-box-shadow: ${shadows};
-webkit-box-shadow: ${shadows};
box-shadow: ${shadows};
`

interesting thing is ...shadows in Javascript is an Array, but if we put into ${}, then it conver to a string:

const shadows = ['red', 'blue'];

console.log(`${shadows}`); // red, blue

[SCSS] Convert SCSS Variable Arguments to JavaScript的更多相关文章

  1. convert image to base64 in javascript

    convert image to base64 in javascript "use strict"; /** * * @author xgqfrms * @license MIT ...

  2. [CSSinJS] Convert Sass (SCSS) Styled Button to CSSinJS with JavaScript Templates and Variables

    This is an introduction to CSSinJS that doesn't require any JavaScript knowledge, just a basic CSS. ...

  3. [SCSS] Organize SCSS into Multiple Files with Partials

    Tired of dealing with monolithic CSS files? Are requests for multiple CSS files hurting your perform ...

  4. javascript arguments与javascript函数重载

    1.所 有的函数都有属于自己的一个arguments对象,它包括了函所要调用的参数.他不是一个数组,如果用typeof arguments,返回的是’object’.虽然我们可以用调用数据的方法来调用 ...

  5. 预编译scss以及scss和less px 转rem

    预编译scss步骤: 1 搜索ruby并安装,点击 2 安装sass: 3 在hubuilder工具中设置预编译: 触发命令地址为ruby安装地址 命令参数为 %FileName% %FileBase ...

  6. [Javascript] Required function arguments in Javascript

    In Javascript, all function arguments are optional by default. That means if you ever forget to pass ...

  7. To add private variable to this Javascript literal object

    You can use number as function/variable name, the numberic name can't be accessed from parent scope, ...

  8. listening for variable changes in javascript

    https://stackoverflow.com/questions/1759987/listening-for-variable-changes-in-javascript

  9. Sass使用教程

    sass官网: http://sass-lang.com/ http://sass-lang.com/documentation/file.SASS_REFERENCE.html Sass和Scss的 ...

随机推荐

  1. Python 34(进程重点)

    一:开启进程的两种方式(*****) #开启进程的方式一: from multiprocessing import Process import time def task(name): print( ...

  2. [转]逐步解說:在 WPF 應用程式中使用 ReportViewer 显示 rdlc

    本文转自:http://msdn.microsoft.com/zh-tw/library/hh273267 若要在 WPF 應用程式中使用 ReportViewer 控制項,您需要將 ReportVi ...

  3. MySql c#通用类 转

    using System;using System.Data;using System.Configuration;using System.Collections.Generic;using Sys ...

  4. Laravel5.1学习笔记9 系统架构1 请求生命周期 (待修)

    Request Lifecycle Introduction Lifecycle Overview Focus On Service Providers Introduction When using ...

  5. mvc3结合spring.net-依赖注入

    namespace Tuzi.Models.IService { public interface IPersonService { string say(string words); } names ...

  6. java基础学习四

    一.java中的基本数据类型 二.double和float精度不准的问题 double和float本身确实存在某种缺陷,不能用于精确计算. 解决办法: 用java.math.BigDecimal,通过 ...

  7. 【系列】Java多线程初学者指南(1):线程简介

    原文地址:http://www.blogjava.net/nokiaguy/archive/2009/nokiaguy/archive/2009/03/archive/2009/03/19/26075 ...

  8. C# Socket发送接收字节数组和十六16进制之间转换函数

    近期在使用远程网络模块的时候, 需要用的Socket发送数据,远程模块指令为16进制. 官方提供的DEMO比较繁琐.不方便新手使用. 下面的转换函数可大大方便新手使用. // 16进制字符串转字节数组 ...

  9. Ubuntu安装中文语言包

    使用Ubuntu 默认的界面感觉不习惯,于是安装KDE界面. 1.安装kde 使用命令行: sudo apt-get install kubuntu-desktop 安装后发现不能使用中文, 在 se ...

  10. 读书笔记「Python编程:从入门到实践」_7.用户输入和while循环

    7.1 函数input()的工作原理 函数input() 让程序暂停运行,等待用户输入一些文本.获取用户输入后,Python将其存储在一个变量中,以方便你使用. message = input(&qu ...