我正在建立一个盖茨比项目gatsby-plugin-sass
.
my gatsby-config.js
file:
module.exports = {
plugins: [
'gatsby-plugin-resolve-src',
'gatsby-plugin-sass',
'gatsby-plugin-react-helmet',
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/assets/images`,
},
},
],
}
我有以下款式文件结构:
|
|src
|-styles
|--base
|--- _variables.scss
|--components
|--- _Buttons.scss
|--- ...
|--main.scss
Im my _Buttons.scss
文件我是输入像这样:
@import '../base/variables';
@use 'sass:color as *;
当我尝试使用sass 颜色函数像这样(如指定https://sass-lang.com/documentation/modules https://sass-lang.com/documentation/modules)
%buttons-focus {
background-color: color.adjust($primary-color, $alpha: -0.5);
}
我收到以下错误:
Invalid CSS after "...nd-color: color": expected expression (e.g. 1px, bold), was ".adjust($primary-co"
在我的 main.scss 中,我导入如下样式:
@import './components/Buttons';
我在监督什么吗?
我尝试过改变@use
with @import
,没有运气。对我来说, gatsby-sass-plugin 似乎不知道 sass 模块。