I'm trying to serve a random image picked from an array in Less.
Here's what I have so far:
@images = ['ancora.svg', 'timone.svg', 'corda.svg', 'bussola.svg'];
@randomimage: `images[Math.floor(Math.random() * images.length)]`;
#footer-widgets .container .row {
background: url("//website.com/path/@{randomimage}") no-repeat scroll right 60px bottom 40px rgba(0,0,0,0);
}
I think I'm doing some syntax error though. Is that the way to call a variable inside a URL (path/@{randomimage}
)?