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

228
Views
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 answers
Answer question

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 Report

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 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!