andrewrk / juice

Juice inlines CSS stylesheets into your HTML source.
MIT License
60 stars 13 forks source link

Not working for Node 0.11.14 #16

Open iliakan opened 10 years ago

iliakan commented 10 years ago

Try this:

var inlineContent = require('juice2').inlineContent;

var result = inlineContent("<!DOCTYPE html><html><body>1</body></html>",
  "body { padding: 5px; } ");

console.log(result);

CSS is not inlined.

3rd-Eden commented 9 years ago

Just ran in to the same issue. Are the plans to support 0.11 or should we abandon ship?

iliakan commented 9 years ago

Btw I switched to Styler until the issue is fixed.

sunnylost commented 9 years ago

I got the same problem, after debug the code, found out when jsdom parse the raw html, it'd encountered an error "Cannot set property length of [object Object] which has only a getter".

So I just updated jsdom to the newest version 3.0.2, and change a little code, the problem was gone.

My fork here, but i didn't test it much, hope this would be helpful.

OrKoN commented 9 years ago

@sunnylost thanks a lot! your fork really helped. And it seems to be working fine on 0.11.15 too! :+1:

OrKoN commented 9 years ago

@sunnylost did you create a pull request?

sunnylost commented 9 years ago

@OrKoN Not yet.

naartjie commented 9 years ago

Take a look at PR andrewrk/swig-email-templates#25, it might help to upgrade jsdom here as well.

Toub commented 9 years ago

@sunnylost a PR would be really appreciated.