Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda