Answer the question
In order to leave comments, you need to log in
${variable} doesn't work in Pug preprocessor, what to do?
Good afternoon, but I can’t continue the project further. For some reason, this construction does not work for me
- var www = 'row_expand.png';
- var img_row = require(`../../../components/length-stay/${www}`);
I pass the img_row variable to the mixin, but everything immediately breaks. It only works like this:
- var img_row = require(`../../../components/length-stay/row_expand.png`); - if you write directly on the forehead.
Help - this is very important, I have a component structure in my project, and I definitely need to be able to operate with variables in the paths.
Answer the question
In order to leave comments, you need to log in
Try like this. The second one must earn 100%.
// 1. Вариант
- var img_row = require(`../../../components/length-stay/#[www]`);
// 2. Вариант
- var img_row = require('../../../components/length-stay/' + www);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question