Priya Payyavula Priya Payyavula - 1 month ago 6
Sass (Sass) Question

Get value by name in SASS

We recently introduced SASS into our project and i am very new to it.

I have a color.scss file which contains the variable name and its value for all the colors used in the project.
I am having difficulty in remembering all the names of the colors.

Example,

@include Font(arial,18px,#4a4a4a,left);


I want to see what is the key for the value #4a4a4a i.e., if the type #4a4a4a , its corresponsing $variable name should show up.
Do we have a better way to do rather than, searching for #4a4a4a in color.scss file?

Thanks for the help in advance.

Answer

Here you want to use something like a hash ,where in you would push color as the key and get the associated variable name.

You need to check to see sass maps

This could be helpful to you https://www.viget.com/articles/sass-maps-are-awesome

and this Using SASS map function instead of variable interpolation