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

226
Visualizações
how to override Angular library scss variables?

I created a library in Angular 12 and I have implemented several components, I wanted to standardize the styling colors so I also implemented scss variables, I have created a SCSS file:

lib\dinotable.scss
$primary-color: green;
$secondary-color: red;

But I also want the library consumers to be able to override the colors in their consuming applications, how can I let them override the variables inside dinotable.scss?

you can find the library here: https://github.com/chr1soscl/dinolib, use "npm run pack-dt" to build and pack the library, the consumer application is here: https://github.com/chr1soscl/dinolib-consumer

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I would suggest trying to set the variables in the TS file instead, and let the end user override it in general configuration. Take a look at this: access SASS values ($colors from variables.scss) in Typescript (Angular2 ionic2)

about 4 years ago · Juan Pablo Isaza Relatório

0

I would suggest to make a seperate SCSS file, maybe called overrides.scss, where the consumers can override the variables themselves. However, you need to make sure that the override styles imported after the default Angular SCSS. This means, you'll maybe have something like:

lib\global-variables.scss

$primary-color: green;
$secondary-color: red;

@import 'overrides.scss'

Note: SASS are deprecating the @import feature and changes it to @use instead in the future.

about 4 years ago · Juan Pablo Isaza 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