Saturday, 9 February 2019

Set sass variable value in Angular 7

I am doing angular from last few weeks ,and now I have a requirement ,dynamically style public site .The site admin set various color codes and logo image from admin in database and these will reflect when the Public Site opens .

As I am from asp.net background ,previously what is do is,on master page load take values from DB and write into a .less file ,and less java-script library take care of it, its simple there.

But for current situation I am using sass and not able find a way how to write variables value into .scss file .

I just learn a new thing APP_INITIALIZER from here ,but ultimately this post not showing how to write in the .scss file.

I am actually thinking this with my asp.net knowledge,but may be I am wrong ,or there are another way of implementation.

I want a simple solution ,what we do in asp.net I want to achieve this in same way.

  1. Take variable value from DB via api,when application loading for first time.

  2. Write values in SASS variable file .

  3. After that SASS will take care of this and we get result as expected .

Please give some suggestion or example ,to start with .

Thanks.



from Set sass variable value in Angular 7

No comments:

Post a Comment