:host-context css does not get applied while AOT build
Angular CLI: 1.7.4 Node: 8.9.0 OS: darwin x64 Angular: 5.2.9 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router
@angular/cli: 1.7.4 @angular-devkit/build-optimizer: 0.3.2 @angular-devkit/core: 0.3.2 @angular-devkit/schematics: 0.3.2 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.2 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 typescript: 2.5.3 webpack: 3.11.0
- Step 1 Create a component with SCSS :host{ color: black; } :host-context(.some-parent .inner-parent) { color: red; }
- Step 2
Use the component in another component's html
- Step 3 Do ng serve and verify that you see color red. But then if you do ng build --prod you see color black ignoring :host-context style which is defined later. If you do ng build --prod --aot=false, then you will see red again
Observed behavior
With AOT enabled build, :host-context style css is skipped and doesn't get included.
This what we observed below is generated ng build --prod

and this is ng serve

Desired behavior
ng build --prod will generate the same css as ng serve.
Mention any other details that might be useful (optional)
I reverted cli version all the way back to 1.4.9 but got the same issue.
Related to https://github.com/angular/angular/issues/23034
Same problem in Angular 7.
Duplicate of angular/angular#23034
@alan-agius4 problem is in CLI and CleanCss plugin, can you reopen here?
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.