angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

:host-context css does not get applied while AOT build

Open chikakow opened this issue 8 years ago • 5 comments

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 image

and this is ng serve image

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.

chikakow avatar Apr 24 '18 19:04 chikakow

Related to https://github.com/angular/angular/issues/23034

mattbrooks2010 avatar Jun 22 '18 16:06 mattbrooks2010

Same problem in Angular 7.

vulpfox avatar Nov 04 '18 14:11 vulpfox

Duplicate of angular/angular#23034

alan-agius4 avatar Feb 05 '19 11:02 alan-agius4

@alan-agius4 problem is in CLI and CleanCss plugin, can you reopen here?

SebastianPodgajny avatar Mar 04 '19 10:03 SebastianPodgajny

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.