html 创建SASS mixins别名

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 创建SASS mixins别名相关的知识,希望对你有一定的参考价值。

<button>Alerted</button>
body:after {
  content: 'hai'; }
// ----
// libsass (v0.7.0)
// ----


// Long mixin name from a library, probably prefixed with a
// namespace to avoid naming clashes. This is a pain to type
// out all the time
@mixin i-am-a-mixin-with-a-long-name($arg1, $arg2) {
  body:after { 
    content: $arg2;
  }
}


// Create a alias mixin with a shorter name that passes
// through all the arguments to the longer named mixin
// The docs for what the ... syntax is can be found at
// http://sass-lang.com/documentation/file.SASS_REFERENCE.html#variable_arguments
@mixin alias($args...) {
  @include i-am-a-mixin-with-a-long-name($args...)
}


// Now you can reference your short alias in your project!
@include alias('blah', 'hai');
<button>Alerted</button>

以上是关于html 创建SASS mixins别名的主要内容,如果未能解决你的问题,请参考以下文章

html Sass:依赖注入Mixins #sass

html Sass:多态占位符和mixins #sass

html Sass:占位符工厂(Mixin)基于argumetns #sass

Sass混合的使用

html Sass:Mixin #sass中基于元素类型的条件样式

使用样式化的组件创建像全局变量、函数、mixin 这样的 SASS