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

Reduce HTTP requests: Combine images into CSS sprite #12

Open
chirag-v opened this issue Feb 19, 2014 · 2 comments
Open

Reduce HTTP requests: Combine images into CSS sprite #12

chirag-v opened this issue Feb 19, 2014 · 2 comments

Comments

@chirag-v
Copy link
Contributor

For those who have several payment methods active, all images generate individual HTTP request. CSS sprites have to be generated manually, which involves generating one image of all logo. Uploading it to server. Pasting the appropriate css in stylesheet.

Would be great if this is possible out of the box.

We need a combined image of logos (preferably in all possible combinations) such as this: http://s16.postimg.org/3wss2n4ol/payment_methods_logos.png

Then make use of background-position property to render it in correct location.

Right now this can be done by adding something like this to style sheet:

//payment logo sprite
ul.accepted-payment-methods li.american-express span {
background-image: url("../images/amex.png");
background-image: url("/path/to/image/payment-methods-logo-stripe.png");
background-position: -6px -6px;
}
ul.accepted-payment-methods li.cash-on-delivery span {
background-image: url("../images/cod.png");
background-image: url("/path/to/image/payment-methods-logo-stripe.png");
background-position: -6px -90px;
}
ul.accepted-payment-methods li.mastercard span {
background-image: url("../images/mastercard.png");
background-image: url("/path/to/image/payment-methods-logo-stripe.png");
background-position: -6px -174px;
}
ul.accepted-payment-methods li.visa span {
background-image: url("../images/visa.png");
background-image: url("/path/to/image/payment-methods-logo-stripe.png");
background-position: -6px -258px;
}

@jameskoster
Copy link
Owner

Feel free to send a PR, I don't have time to do this myself atm.

@chirag-v
Copy link
Contributor Author

Have sent through with all necessary changes.

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