4
votes

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.

3

3 Answers

10
votes

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.

0
votes

If you are using the webpack branch, then node_modules will not exist in the served directory. You will have to import the libraries you want to use, which will cause webpack to bundle them for you. Alternatively modify apps[0].scripts and apps[0].styles properties of angular-cli.json like in https://github.com/angular/angular-cli#global-library-installation.

0
votes

Seems like 1.0.0-beta.11-webpack.9-4 has also fixed the bug