Answer the question
In order to leave comments, you need to log in
How to insert variable from json to sass?
Hi all. Tell me how to insert a variable from JSON into SASS ? Maybe someone has done this?
Such a situation: there is a project structure that assumes that the path to the first picture on the first page will be like this:
background: url(assets/private/common/img/logo.png);
background: url(assets/private/page/img/avatar.png);
. "переменная_№1_из_JSON": "assets/private/common";
background: url("переменная_№1_из_JSON"/img/logo.png);
"переменная_№2_из_JSON": "assets/private/page";
background: url("переменная_№2_из_JSON"/img/logo.png);
Answer the question
In order to leave comments, you need to log in
https://github.com/vigetlabs/sass-json-vars
but I would not advise doing such garbage
js should not know anything about image paths
in css / sass at all there is no need to redefine image paths (maximum - redefine paths during assembly )
*for general development - you can create any garbage, but why
https://css-tricks.com/making-sass-talk-to-javascr...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question