Sass 无法在包含在其他文件中的文件中使用变量
我使用的是SASS,文件结构如下:Sass 无法在包含在其他文件中的文件中使用变量,sass,compass-sass,Sass,Compass Sass,我使用的是SASS,文件结构如下: resources/ style.scss partials/ _variables.scss _components.scss components/ componentA/ componentA.scss style.scss包括_variables.scss和_components.scss 变量在_variabels.scss中定义 组件目录中的SASS文件包含在_compon
resources/
style.scss
partials/
_variables.scss
_components.scss
components/
componentA/
componentA.scss
- style.scss包括_variables.scss和_components.scss
- 变量在_variabels.scss中定义
- 组件目录中的SASS文件包含在_components.scss中
不幸的是,如果我在_variables.scss中创建一个变量,那么任何组件sass文件(例如componentA.scss)都无法访问该变量。它抱怨没有定义变量。这是SASS的限制吗?我需要定义某种全局范围还是什么?在使用任何变量之前,必须导入
\u variables.scss
通过给出的例子,错误来自
componentA.scss
,它被编译成一个单独的css文件,以css/componentA/componentA/componentA.css
,因此当编译样式表时,它没有定义变量,因为componentA.scss
没有导入\u变量。scss
是所有包含在style.scss
?你能在你的问题中添加你的include声明吗?