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

Is there possibility to include image in css file? #5

Closed
pfk-beta opened this issue Sep 18, 2012 · 7 comments
Closed

Is there possibility to include image in css file? #5

pfk-beta opened this issue Sep 18, 2012 · 7 comments

Comments

@pfk-beta
Copy link
Contributor

No description provided.

@imsky
Copy link
Owner

imsky commented Sep 18, 2012

Can you give an example of how you'd want this to work?

@pfk-beta
Copy link
Contributor Author

I placed in css something like this:
background-image: url('holder.js/200x300');
Then Holder checks all element in DOM, in searching css atribute background-image. If found, it changes it. And I'm wondering whether is it worthwhile.

@imsky
Copy link
Owner

imsky commented Sep 18, 2012

It's an interesting idea, though it requires a fair amount of additional processing. I'll see if I can get this into 1.4.

@timiles
Copy link

timiles commented Sep 19, 2012

I need this too - in the meantime, I have worked around this with custom js (requires jQuery):

            var backgroundImageContainer = $("<div>").attr("id", <some_unique_id>).addClass("hidden");
            $("body").append(backgroundImageContainer);
            Holder.add_image("holder.js?200x200", "#" + backgroundImageContainer.attr("id")).run();
            $(<my_element_selector>).css("background-image", "url(" + $("img", backgroundImageContainer).attr("src") + ")");
            backgroundImageContainer.remove();

@jasperkennis
Copy link

Compass allows for inline images to be declared right into the css. I don't know how it works, but it might be of help to have a look in te the source if the proposed functionality is to be included into holder.

@imsky
Copy link
Owner

imsky commented Sep 23, 2012

@jasperkennis Compass encodes the image file using Base64 and embeds it using the data URI scheme. To mirror the same functionality, Holder would need to parse CSS, which at this stage would be unnecessary. I've already tested the CSS placeholder approach, it works, and will be included in 1.4 as soon as possible.

@imsky imsky closed this as completed in 653b358 Sep 29, 2012
@imsky
Copy link
Owner

imsky commented Sep 29, 2012

This is now implemented, see https://github.com/imsky/holder#background-placeholders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants