Greg Hila Greg Hila - 2 months ago 128
Node.js Question

angular-cli@webpack with primeng 404 issues

I get the following errors in a starter project with angular2, angular-cli@webpack and primeng. The only ui component from PrimeNG is a dropdown which renders and it has its values but no css theme is applied ever.(see errors below in regards to CSS). I am not sure why I get this error and have spent countless hours with no result so I am at a loss at this point. Component was generated with ng command and ng serve runs the web server. Anybody any idea? I also have tried both node.js 6.5.0 and 4.5.0 (switching and managing them with nvm).

Any help is appreciated deeply.


Failed to load resource: the server responded with a status of 404
(Not Found)
http://localhost:3000/node_modules/primeng/resources/primeng.min.css
Failed to load resource: the server responded with a status of 404
(Not Found)
http://localhost:3000/src/app/resources/css/font-awesome-4.6.3/css/font-awesome.min.css
Failed to load resource: the server responded with a status of 404
(Not Found)
http://localhost:3000/node_modules/primeui/primeui-ng-all.min.css
Failed to load resource: the server responded with a status of 404


By the way now I posted the code in: https://github.com/GregHila/primeng-angular-cli.

Answer

Under the src/ there should be a file styles.css. I think you can import the styles here.

Eg.:

@import '../node_modules/primeng/resources/primeng.min.css';

The other way is to mention them in the angular-cli.json file in the styles array.