Answer the question
In order to leave comments, you need to log in
How to inject a variable from SASS into index.html ?
Hello.
In sass file I have $section_width variable. There was a need to use it in the html markup as an attribute value. How to do it correctly? In the direction of which technologies to google?
Answer the question
In order to leave comments, you need to log in
In the direction of technology "how to stop carrying heresy and start thinking normally."
SASS is a preprocessor, that is, "buns" that will allow you to write css faster. SASS is compiled to CSS/ The browser knows nothing about your *.sass.
As written above, this is an attempt to make everything in a Jesuit unnatural way.
It is necessary to make sure that there is no "emerging need" described by you. To work with the JavaScript document itself to help.
I want to use $section_width in an svg line tag as the value of the x1 attribute. I wanted to implement this as a css rule, but it did not work out. I think to try, with the help of JS, to assign the x1 attribute the width of the section when the page loads. But there must be a smarter solution, I'm sure.
Of course, you can just set the x1 value in pixels, but this will mean that every time the section width changes, you will need to manually rewrite the x1 value. This is contrary to MVC, right?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question