简体   繁体   English

创建SCSS主题错误

[英]Creating SCSS themes error

I have file themes.scss under /javascript/components/themes.scss 我在/javascript/components/themes.scss下有文件themes.scss

Here is code in it 这是其中的代码

   $themes: (
  flysmarter:(
    searchFieldBorder:1px solid #0A5AA6,
    searchFieldBackgound:#FFF,
    searchFieldColor: #0A5AA6,
  ),
  flygcity:(
      backgroundColor:#eccc00,
  ),

);
@mixin themify($themes) {
    @each $theme, $map in $themes {
      .theme-#{$theme} & {
        $theme-map: () !global;
        @each $key, $submap in $map {
          $value: map-get(map-get($themes, $theme), '#{$key}');
          $theme-map: map-merge($theme-map, ($key: $value)) !global;
        }
        @content;
        $theme-map: null !global;
      }
    }
  }
  @function themed($key) {
    @return map-get($theme-map, $key);
  }

I need to import it in file that under ../components/searchfield/styles/searchfield.css 我需要将其导入../components/searchfield/styles/searchfield.css下的文件中

I wrote import like this @import url('../component/themes.scss'); 我写了这样的导入@import url('../component/themes.scss');

But when I run webpack I have this error. 但是,当我运行webpack时,出现此错误。

Module build failed: @include themify($themes) { ^ No mixin named themify 模块构建失败:@include themify($ themes){^没有名字为它们的mixin

When files in same directory, all okay. 当文件在同一目录中时,一切正常。 How I can fix it? 我该如何解决?

I found solution 我找到了解决方案

Just need to write this 只需要写这个

@import '../../themes.scss';

And now it works. 现在就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM