C
C
Codarsis2014-08-04 13:55:29
HTML
Codarsis, 2014-08-04 13:55:29

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

3 answer(s)
E
Evgeny Komarov, 2014-08-04
@maNULL

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.

Z
zooks, 2014-08-04
@zooks

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.

C
Codarsis, 2014-08-04
@Codarsis

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 question

Ask a Question

731 491 924 answers to any question