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

Added a new retina-image mixin for quick retina background-images #157

Closed
wants to merge 3 commits into from

Conversation

plapier
Copy link

@plapier plapier commented Dec 21, 2012

Pertaining to #136

@mixin retina-image($filename, $image-width, $image-height, $extension: png, $retina-filename: null, $asset-pipeline: false) {
background-image: url($filename + "." + $extension);
height: $image-height;
width: $image-width;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to set the height and width properties?
The current mixin forces the elements height and width, which may be different from the image-dimensions and background-size.

A user might want to do:

background-image: url(...);
background-repeat: no-repeat;
background-size: 60px 50px;
height: 300px;
width: 300px;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. What about an optional background-size instead?

background-size: $image-width $image-height;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to change the mixin to accept a $background-size variable rather than $image-width, $image-height.

This way you can pass anything to the background-size property: contain cover or 50px 100px

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also removing the height and width from this mixin.

@kaishin
Copy link

kaishin commented Dec 21, 2012

I tend to use background images in combination with linear-gradient. Any way to make this mixin take that into consideration?

@JoshuaJones
Copy link

We are starting to step into a lot of different use cases I think.

You have basic retina-image needs, which would be an icon which makes use of the width and height as wells as background-size, the need for repeating retina-image needs, for example a texture on the body which doesn't need the width and height, and then you have what @kaishin brings up; multiple backgrounds.

Thoughts on maybe breaking things up? A retina-image mixin and perhaps a retina-background mixin?

@plapier
Copy link
Author

plapier commented Feb 1, 2013

New PR with changes, see here: #174

@plapier plapier closed this Feb 1, 2013
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

Successfully merging this pull request may close these issues.

None yet

3 participants