[英]How to use custom theme/colors for Svelte Material UI (SMUI) components in Sapper project?
[英]How to solve (plugin postcss) Error: File to import not found or unreadable: smui-theme. Material UI Svelte project
我正在將Material UI集成到 Svelte 項目中。
!] (plugin postcss) Error: File to import not found or unreadable: smui-theme.
node_modules/@smui/tab/_index.scss
Error: File to import not found or unreadable: smui-theme.
可能是什么問題?
該錯誤意味着您必須有一個名為_smui-theme.scss
的文件才能編譯 Sass。
首先確保您的項目中的theme
目錄下有_smui-theme.scss
文件。 (我通常放在src/theme/_smui-theme.scss
)
然后你必須像這樣將它添加到你的匯總插件的postcss
配置中:
import postcss from 'rollup-plugin-postcss';
export default {
...
plugins: [
svelte({
...
}),
....
postcss({
extract: true,
minimize: true,
use: [
['sass', {
includePaths: [
'./src/theme', <<< ------------ HERE
'./node_modules'
]
}]
]
}),
...
};
確保theme
目錄很好地包含在postcss
插件配置中,如前所示。
注意:如果路徑不對,你可能會收到同樣的錯誤!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.