Can anyone please tell me how to concatenate a var and a string in LESS so I don't have the space between them?
I have the following code:
.text(@size) {
font-size: @size + px;
line-height: (@size / 10) + em;
}
h1 {
.text(16)
}
What the LESS outputs is the following:
h1 {
font-size: 12 px;
line-height: 1.2 em;
}
I need to find a way to remove the spaces.
Thanks Pete
In JavaScript, we can assign strings to a variable and use concatenation to combine the variable to another string. To concatenate a string, you add a plus sign+ between the strings or string variables you want to connect. let myPet = 'seahorse'; console.
Concatenation is the process of combining two or more strings to form a new string by subsequently appending the next string to the end of the previous strings. In Java, two strings can be concatenated by using the + or += operator, or through the concat() method, defined in the java. lang. String class.
If you want to concatenate a string and a number, such as an integer int or a floating point float , convert the number to a string with str() and then use the + operator or += operator.
In case any late-comers find this thread:
There is a built-in function for this:
unit(@dimension, [@unit: ""]);
So font-size: unit(@size, px);
should result in font-size: 12px
. I tested it.
http://lesscss.org/#reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With