![](/img/trans.png)
[英]Material Design Lite (MDL) VS Angular2 Material in Angular2 app
[英]Including Material Design Lite (MDL) in Angular2
我正在嘗試將材料設計精簡版包含在我的Angular 2.0(最終)項目中(使用webpack)。 我正在使用此設置:
sassLoader = { includePaths: [ path.resolve( __dirname, "./node_modules/material-design-lite/src") ] };
在npm開始時,我收到一條錯誤消息,指出app.component.scss中的變量無法找到。 更具體地說,我收到以下錯誤消息:
ERROR in ./src/app/app.style.scss
Module build failed:
@import "variables";
^
File to import not found or unreadable: variables
Parent style sheet: stdin
in d:\Project Files\<full-path>\src\app\app.style.scss (line 4, column 1)
@ ./src/app/app.component.ts 25:21-48
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.browser.ts
@ multi main
看起來最后一步(包括webpack的路徑)不起作用,但是我不知道如何解決這個問題。
正如TeoMatthew所指出的那樣,webpack配置文件位於項目根目錄的子目錄中,因此需要使用“../”來引用webpack中的根目錄,如下所示:
path.resolve(__dirname, '../node_modules/normalize-scss/sass')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.