0

I am building own UI lib for internal use in my projects. I already have some modules ready and started using it and it make me think how can I 'expose' scss variables to be overwritten in application consuming that library. Something like what ionic is doing for its components (on each component there is list of scss variables it is using which can be overriden in apps scss.

2 Answers 2

2

Make two files : one for configuration, one for styling.

The user will import the configuration, edit the variables, then import the styling. This would give

@import 'myLib/variables';

$color: green,
$background: yellow;

@import 'myLib/styling';
Sign up to request clarification or add additional context in comments.

2 Comments

This was my first thought as well.
Thanks, made it working this way. I didn't think of doing that before for some reasons. I was trying to use compiled css files
1

Usualy you will start with _variables.scss , theme.scss (where you import all prtial files ) , but as advice you have to create a prtial scss file for each component like dropdown , card , button ....etc for example primeng has something like this and you may give a look to bootstrap repo.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.