How can I use a Less variable to give the source address?

Asked

Viewed 35 times

1

In my file Less I have a variable called @address with the main address where the fonts are, I have several fonts and need to put the directory in all with this variable, but it does not work.

One of the sources of the Less

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400;
  src: local("Segoe UI"), local("Open Sans"), local("OpenSans"), url(@@address/ui/lib/fonts/opensans/v8/K88pR3goAWT7BTt32Z01mz8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');

In url(@@address/ui/lib/.....) I need it to be the value of the variable! How can I do this, why isn’t it working?

1 answer

2


Use @{nome_da_variavel}:

For example:

@address: "/ui/lib/fonts/opensans/v8";

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400;
  src: local("Segoe UI"),
       local("Open Sans"),
       local("OpenSans"),
       url("@{address}/K88pR3goAWT7BTt32Z01mz8E0i7KZn-EPnyo3HZu7kw.woff") format('woff');
}
  • It didn’t work to use like this

  • A semicolon was missing at the end of the variable declaration :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.