如何将MDC组件sass文件导入到angular 4项目中?编译器无法编译.scss文件,因为它们的@import
语句不是相对的 - 它们只指向@material
。例如,这是mdc-button.scss @import
语句:
@import "@material/animation/variables";
@import "@material/animation/functions";
@import "@material/elevation/mixins";
@import "@material/ripple/mixins";
@import "@material/theme/mixins";
@import "@material/typography/mixins";
这会导致编译器失败,因为它找不到@material
,因为该文件位于node_modules/@material/button/mdc-button.scss
中,因此它需要实际@import "../animation/variables"
等。
图书馆位于https://github.com/material-components/material-components-web/
答案 0 :(得分:1)
根据您的sass工具,(我正在使用Koala)您必须将额外的路径信息添加到您的sass配置中:
// Sass project settings, you can edit it and set custom settings.
// An array of filesystem paths or importers which should be searched for
//Sass templates imported with the @import directive. (I am on windows it might be
//different for other O/S)
"includePaths": ["C:\\Users\\loggedInUser\\node_modules"],
"requireLibs": []