M
M
mr_blond972017-03-02 22:27:04
css
mr_blond97, 2017-03-02 22:27:04

How to use mixin with 2 parameters in url in less?

How to use mixin with 2 parameters in url in less?
Non-working code:

.pic_url(@folder;@name) {
    background-image: url("/@{folder}/@{name}.png");
}
.span {
    .pic_url(F1;N1);
}

Need to get this CSS?
.span {
    background-image: url("/F1/N1.png");
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pastaraje, 2017-03-09
@Pastaraje

.pic_url(@folder: define;@name: me) {
  background-image: url("/@{folder}/@{name}.png");
}

.span {
  .pic_url();
}
.span {
  .pic_url(images;some);
}
.span {
  .pic_url(@name: pls);
}
.span {
  .pic_url(@folder: folder;@name: file);
}

At the exit
.span {
  background-image: url("/define/me.png");
}
.span {
  background-image: url("/images/some.png");
}
.span {
  background-image: url("/define/pls.png");
}
.span {
  background-image: url("/folder/file.png");
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question