thom4parisot / Imager.jsx

A React component for responsive images in desktop and mobile browsers. Featuring Imager.js.
https://npmjs.com/imager.jsx
MIT License
32 stars 7 forks source link

server side rendering #10

Open joernroeder opened 9 years ago

joernroeder commented 9 years ago

Me again ;) After including Imager.jsx successfully into my project i'm getting a bunch of Imager related errors whenever i try to render it on the server side. (ReferenceError: window is not defined)

Enabling the library just on the client isn't a big deal, but I don't now which image size should be rendered on the server without knowing anything about the connected client. Mobile first? What do you think?

thom4parisot commented 9 years ago

We could add a dependency on the global npm module (or something similar/smaller) to be fully server side and client side.

If you do render things server side, it should be used only for the sake of React reconciliation. Very interesting use case :-)

If you work out something today, please propose a merge request. I would be happy to review it and to merge it :-)