Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

including an image path in a mixin? #19

Closed
jannisg opened this issue Oct 27, 2010 · 2 comments
Closed

including an image path in a mixin? #19

jannisg opened this issue Oct 27, 2010 · 2 comments

Comments

@jannisg
Copy link

jannisg commented Oct 27, 2010

I'm trying to write a simple mixin that I can use to place an dropshadow image into, the mixin that isn't working is this:

@mixin dropshadow($img,$padding:30) {
    padding-bottom: $padding+px;
    background:{
        image: url(../images/+$img);
        position: center bottom;
        repeat: no-repeat;
    }
}

This doesn't work and I get this error

error scss/style.scss (Line 309: Invalid CSS after " image: url(": expected ")", was "../images/+$img);")

Any ideas on how I can do this?

@nex3
Copy link
Contributor

nex3 commented Oct 27, 2010

According to the CSS spec, url() is another form of string quotes, so Sass treats it the same way (usually). In order to include a variable along with some other text, you need to use #{}, as in url(../images/#{$img}).

@jannisg
Copy link
Author

jannisg commented Oct 27, 2010

works great, thanks!

nex3 added a commit that referenced this issue Apr 5, 2019
Merge pull request #19 from sass/proposal.module-system.draft-3
nex3 added a commit that referenced this issue May 17, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants