Reputation: 769
I need to use a less variable to import google fonts into a stylesheet.
The current way I am doing it is: @import url(@{googleFonts});
The variable I am passing into LESSPHP is: "googleFonts" => "http://fonts.googleapis.com/css?family=Linden+Hill"
However, all it is compiling to is: import url(http);
The past import statement I tried was: @import url(http://fonts.googleapis.com/css?family=@{googleFonts});
With the variable of just: Linden+Hall
This worked better, but the problem I ran into here was the + was being stripped. Leaving just LindenHall
.
So if you know how to make the compiler leave the + alone, then that works just fine aswell!
Upvotes: 0
Views: 115
Reputation: 72261
Try an extra set of quote marks around your path (note the '
):
"googleFonts" => "'http://fonts.googleapis.com/css?family=Linden+Hill'"
From the LESS PHP documentation, it states:
Be aware that the value of the variable is a string containing a CSS value. So if you want to pass a LESS string in, you're going to need two sets of quotes. One for PHP and one for LESS.
Upvotes: 2