Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to do pattern matching with sass or another css templating language?

Tags:

css

sass

I'd like to have the images of a playing card displayed with CSS. But it would be great if there was a templating language that could set up a style like:

.playing-card-(.*) {
   width: 30px
   height: 40px
   background-image: "/images/cards/$1.gif"
}

Does such a thing exist?

like image 214
Jeremy Smith Avatar asked Dec 21 '25 06:12

Jeremy Smith


1 Answers

I'd love for this to exist but where I've had to do simular tasks I've had to rely on the server side to write the background-image as an inline style or use JS to do it (eg if I'm loading the data via AJAX).

like image 63
Ahmed Nuaman Avatar answered Dec 22 '25 23:12

Ahmed Nuaman