css - sass background mixins using url -


this question has answer here:

guys create background mixin instead writing repeated url

 @mixin bgimage($name){   $url:"../images/$name.png";  background: url($url);} 

and,it never accept valuee $name variable

i called

     @include bgimage(name.png); 

and in css output came wrong this

     background: url("../images/$name.png"); 

is there way write url in mixin ? ot how in short way

try variable interpolation of #{$name}

@mixin bgimage($name) {   $url:"../images/#{$name}.png";   background: url($url); } 

and pass filename, without extension, mixin parameter:

@include bgimage(your-png-file-without-extension); 

since appended in $url variable of mixin


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -