我按照https://yakovfain.com/2016/10/28/adding-primeng-ui-components-to-angular-cli-project/的说明操作。
默认内容为:
"styles": [
“styles.css”
]
ng serve命令有效。一旦我包含其他样式表:
"styles": [
"styles.css",
"../node_modules/primeng/resources/themes/omega/theme.css",
"../node_modules/font-awesome/css/font-awesome.min.css",
"../node_modules/primeng/resources/primeng.min.css"
]
我收到错误:
Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token / in JSON at position 630
InvalidConfigError: Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token / in JSON at position 630
at InvalidConfigError (C:\xampp\htdocs\myapp1\node_modules\@angular\cli\models\config\config.js:10:9)
at Function.fromConfigPath (C:\xampp\htdocs\myapp1\node_modules\@angular\cli\models\config\config.js:74:19)
at Function.fromProject (C:\xampp\htdocs\myapp1\node_modules\@angular\cli\models\config.js:91:46)
at Object.<anonymous> (C:\xampp\htdocs\myapp1\node_modules\@angular\cli\commands\build.js:7:35)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
我查看了其他stackoverflow条目,这种格式似乎是正确的,我该如何解决?
答案 0 :(得分:0)
您必须在angular-cli.json中添加所有节点模块css,以便可以在第一阶段进行编译。
"styles": [
"./styles.scss",
"../node_modules/angular2-toaster/toaster.css",
"../node_modules/font-awesome/css/font-awesome.css",
"../node_modules/@swimlane/ngx-datatable/release/datatable.css",
"../node_modules/@swimlane/ngx-datatable/release/material.css",
"../node_modules/@swimlane/ngx-datatable/assets/icons.css"
],