Search code examples
angularwebpackpostcss

How to install postcss with Angular2 CLI the right way


just learning Angular2 and I want to install postcss. I found several older posts that try to explain how to install postcss on Angular2. All of them are obsolete since none of them takes into account that there is no angular-cli-build.js anymore since Angular2 CLI is using webpack now. I installed the loader npm install postcss-loader --save-dev and created the config file postcss.config.js as described in the npm repo but whats next? Do I need to add it to angular-cli.json? If so - how? Any help appreciated! Many thanks in advance.


Solution

  • Yes, Angular CLI is using webpack, but it is not allow to config and It seem that there is no plan to allow developer to config it. ( Ref: https://github.com/angular/angular-cli/issues/1656#issuecomment-249921747 )

    However, there is a work around solution mentioned in this comment: https://github.com/angular/angular-cli/issues/1512#issuecomment-254262959