M
M
Mairrel2020-04-07 03:06:48
Less
Mairrel, 2020-04-07 03:06:48

Mixin in Less doesn't want to be called??

.dest(@path) {
background-image: url(../img/icon/@path);
}

call

.icon-1 {
.dest(icon-1.png);
}

gives :

Message:
expected ')' got '.' in file C:....\source\less\icon.less line no. 15
Details:
type: Syntax
filename: C:...\source\less\icon.less
index: 248
line: 15
column: 14
callLine: NaN
callExtract: undefined
extract: .icon-1 {, .dest(icon-1 .png);,}
lineNumber: 15
fileName: C:...\source\less\icon.less
domainEmitter: [object Object]
domainThrown: false

It seems to me that there is some problem in the line background-image: url(../img/icon/@path); that you need something like /{@path} or /@{path} ... But I can't figure out how (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stepan Krapivin, 2020-04-07
@Mairrel

write the path as a string and output the variable as a string

.dest(@path) {
  background-image: url('../img/icon/@{path}');
}

.icon-1 {
  .dest('icon-1.png');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question