Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
host-context scss rules not showing in production build

In my Angular project, I have scss rules that describe how components should look when in the context of another component. Example:

:host-context(my-table my-row.header){
  font-weight: 500;
  white-space: nowrap;
  height: 40px;
  color: #6d6d6d;
  background-color: #f3f3f3;
}

This works fine when working on localhost, however when I build it for production & put it live it does not apply that styling. Not sure what the difference would be?

Looking for suggestions on how to fix this so that the styling shows on production as well as development.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Okay after googling & experimenting a bunch I finally figured out how to fix the issue, although I have no idea why or why it works in dev but not in prod.

Essentially, if you use :host-context with multiple selectors, like so:

:host-context(my-table my-row){ ... }

It works in dev but will not work in prod.

Instead you should replace that with:

my-table my-row :host-context{ ... }

If you're only using one selector inside like :host-context(my-table){ ... } it works as expected on both prod & dev.

Credit to this comment I found https://github.com/angular/angular-cli/issues/8577#issuecomment-379177320 for giving me insight into how to move foward.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!