[英]Angular-cli, PrimeNG and angular-cli
有人可以帮忙:我试图让PrimeNG使用使用angular-cli创建的Angular应用程序。 我在我的新应用程序(使用CLI创建)中安装了PrimeNG,但我无法使样式工作。 PrimeNG网站声明我需要在Index.html中添加以下内容
href="../node_modules/primeng/resources/themes/omega/theme.css"
href="/node_modules/primeng/resources/primeng.min.css"
href="./assets/font-awesome-4.7.0/css/font-awesome.min.css"
注意我已经尝试过,我尝试将这些添加到angular-cli.json文件样式数组中,现在仍然运气好。
"styles": [
"styles.css",
"../node_modules/primeng/resources/themes/omega/theme.css",
"../node_modules/primeng/resources/primeng.min.css",
"./assets/font-awesome-4.7.0/css/font-awesome.min.css"
]
请有人帮忙。
提前致谢。
在你的项目文件夹中有一个名为styles.css的文件夹,然后尝试这个。
/* You can add global styles to this file, and also import other style files */
@import url('../node_modules/primeng/resources/themes/omega/theme.css');
@import url('../node_modules/primeng/resources/primeng.min.css');
@import url('../node_modules/font-awesome/css/font-awesome.min.css');
@import url('../node_modules/bootstrap/dist/css/bootstrap.min.css');
您应该检查您的路径和文件,这些设置可能已过时。 例如, primeNG与omega/theme.scss
一起提供 ,而不是css。 此文件可能不存在于node_modules
目录中。
我在angular-cli中使用了以下设置,它看起来效果很好:
"styles": [
"styles.css",
"../node_modules/primeng/resources/primeng.css"
]
请注意,angular-cli(beta-30)会将这些文件内容附加为<style>
标记。
另外,我在最近几天做了类似的事情(使用primeNG组件的angular-cli项目) - 尝试我的(仍在建设中) 演示存储库 ,它使用primeUI作为样式,但它可能会有所帮助。 您可能需要查看此项目中的angular-cli.json。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.