Sass compiler throws 'undefined mixin' error when mixins are kept in seperate folder [closed]

我们两清 提交于 2021-02-07 13:36:51

问题


Here is the screenshot of my website structure. Screenshot of project structure

In my mixins file, I have created all the necessary sass mixins.

I have created this mixin for border radius:

 @mixin border-radius($radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
       -o-border-radius: $radius;
          border-radius: $radius;
}

Now when I try to use this for my button class in _button.scss in modules folder , I get undefined variable error. Whereas when I use the same mixin in the _button.scss file itself, I don't get any error.

in my _button.scss file i have included the mixin as under

button{
    background-color: $theme-color;
    border: 0px solid;
    padding: 0.7rem 3rem;
    @include border-radius(2rem);

}

What is the issue exactly. I want to keep all my mixins in a seperate file to keep the structure neat.


回答1:


you have to include the mixin with @include or @import

http://sass-lang.com/documentation/file.SASS_REFERENCE.html#including_a_mixin



来源:https://stackoverflow.com/questions/29591196/sass-compiler-throws-undefined-mixin-error-when-mixins-are-kept-in-seperate-fo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!