Answer the question
In order to leave comments, you need to log in
How to create an image path variable and assign it to classes?
When laying out a layout in less, I often use background-image (or just background). The fact is that when transferring or creating a template, many paths change (at once for the entire project) and I want to somehow set globally and once a variable that I will substitute in background.
How is this done in LESS? I tried to do it, even looked at the documentation, but when compiling (via Prepros) I get errors.
So:
- now: background-image: url(../img/header.jpg);
- need:
@path_to_template: /template/test
background-image: url( @path_to_template /img/header.jpg);
Answer the question
In order to leave comments, you need to log in
Sass is better than Less, I advise you to study it, the differences are not big, you don’t need to put {} and ; at the end
write 1 big structured tree:
.block
font-size: 14px
.block-head
color: #fff
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question