Angular 2 SCSS造型

时间:2018-01-20 10:19:40

标签: angular scss-lint

我在主根文件style.scss中写了scss mixin。当我尝试在我的主组件中访问它时,它给出了错误,因为没有mixin命名渐变。

请帮助我需要在我的组件中包含styles.scss文件



//linear gradient color
$from: #1279C9;
$to: #439FE7;

@mixin gradient($from, $to) {
    /* fallback/image non-cover color */
    background-color: $from;
  
    /* Firefox 3.6+ */
    background-image: -moz-linear-gradient($from, $to);
  
    /* Safari 4+, Chrome 1+ */
    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to));
  
    /* Safari 5.1+, Chrome 10+ */
    background-image: -webkit-linear-gradient($from, $to);
  
    /* Opera 11.10+ */
    background-image: -o-linear-gradient($from, $to);
  }




2 个答案:

答案 0 :(得分:0)

尝试在一些易于访问的位置(比如说/ app / scss)中的某个主文件中定义mixin,然后将该master导入到应该像用户一样的组件样式中

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat Jan 20 11:38:18 CET 2018
There was an unexpected error (type=Bad Request, status=400).
Failed to convert value of type 'java.lang.String' to required type 'java.lang.Integer'; nested exception is java.lang.NumberFormatException: For input string: "{1}"

然后应该识别出Mixin。

答案 1 :(得分:0)

我使用master.scss文件执行此操作,并且我在每个组件scss文件中包含此文件