ckirkendall / enfocus

DOM manipulation and templating library for ClojureScript inspired by Enlive.
http://ckirkendall.github.com/enfocus-site/
370 stars 41 forks source link

How can I use holder.js in html snippet? #95

Closed kostafey closed 10 years ago

kostafey commented 10 years ago

How can I use holder.js in html snippet?

It's impossible to simple use

<img src="holder.js/200x300">

(despite holder.js is loaded on target page).

ckirkendall commented 10 years ago

it might be the onLoad function of holder is running before the snippet is loading. Looking at the documentation for holder.js it seems that you need to run Holder.run() after the snippet is loaded.

CK

On Sat, May 31, 2014 at 12:38 PM, kostafey notifications@github.com wrote:

How can I use holder.js https://github.com/imsky/holder in html snippet?

It's impossible to simple use

(despite holder.js is loaded on target page).

— Reply to this email directly or view it on GitHub https://github.com/ckirkendall/enfocus/issues/95.

kostafey commented 10 years ago

It fails when loading /holder.js/128x128 inside compiled main.js:

GET 404 Not Found text/html main.js:28516 Script

May be it should not try to load this resource and output it literally?

ckirkendall commented 10 years ago

Use data-src instead of src. Holder.js says it supports both.

Creighton On May 31, 2014 1:00 PM, "kostafey" notifications@github.com wrote:

It fails when loading /holder.js/128x128 inside compiled main.js:

GET 404 Not Found text/html main.js:28516 Script

May be it should not try to load this resource and output it literally?

— Reply to this email directly or view it on GitHub https://github.com/ckirkendall/enfocus/issues/95#issuecomment-44753501.

kostafey commented 10 years ago

Thank you very much!

The solution is to use data-src and run the following code after the snippet is rendered:

(.run js/Holder)