问题描述
如何在我的应用中添加角度素材主题。
How can I get angular material theme included in my app.
我在variable.scss中尝试了@import'~@angular/material/prebuilt-themes/indigo-pink.css'并尝试使用我的app的styleUrls中的路径模块也是。尝试使用'../../node_modules/@angular/material/prebuilt-themes/indigo-pink.css'。
I tried @import '~@angular/material/prebuilt-themes/indigo-pink.css' in variable.scss and tried using the path in styleUrls of my app module as well. Tried using '../../node_modules/@angular/material/prebuilt-themes/indigo-pink.css' as well.
在所有情况下,浏览器都给出了404
In all the cases browser is giving 404
推荐答案
此错误是由于离子应用程序脚本中存在的配置,其中不包括其他node_modules路径。要解决此问题,请在配置文件夹中创建一个文件
This error is due to the configuration present in ionic app-scripts which doesn't include other node_modules paths. To fix this create a file
以下内容
// cross verify with node_modules/@ionic/app-scripts/config/sass.config.js
module.exports = {
/**
* includePaths: Used by node-sass for additional
* paths to search for sass imports by just name.
*/
includePaths: [
'node_modules/ionic-angular/themes',
'node_modules/ionicons/dist/scss',
'node_modules/ionic-angular/fonts',
'PATH/TO/YOUR/FILE'
]
};
更新文件
并添加以下内容
"config": {
"ionic_sass": "./config/sass.config.js"
},
这将覆盖提供的默认app-script配置。
This would override the default app-script config for what is provided.
这篇关于将角度材料主题添加到离子3中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!