0

Several other questions/answers here say to use the variable @{baseDir} to get the URL for background-image. I added this to my themes less file, however, when I compile, it crashes.

variable @baseDir is undefined

I do not understand how to proceed. I found several other files that have the reference to baseDir and it works fine, but in this specific less file, it doesn't. Frustrated.

0

Please use the base URL like this

First add image in app\design\frontend\vendor\theme\web\images folder and write css as below:

background: url('@{baseDir}images/icon_sprite.png');

after add new image run command as below:

- php bin/magento cache:clean
- php bin/magento setup:static-content:deploy

if it's helpful please accept it, Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.