html2jade icon indicating copy to clipboard operation
html2jade copied to clipboard

Does not work under Node 0.11.x and 0.12.x

Open resistdesign opened this issue 11 years ago • 17 comments

When supplying a file that has a DIV as the outer most element I only get the DIV in the jade file and not any of it's children.

resistdesign avatar Oct 08 '14 17:10 resistdesign

Seems to be an issue when running node 0.11.x.

resistdesign avatar Oct 08 '14 18:10 resistdesign

Looks like most of the unit tests fails under Node 0.11.x with similar symtom (child nodes missing or truncated). Primary suspect is HTML parser or DOM implementation modules because html2jade outputs what it sees.

donpark avatar Oct 08 '14 20:10 donpark

any updates on this

skandasoft avatar Dec 06 '14 06:12 skandasoft

just tried with same result which is not surprising since jsdom-little hasn't changed.

do have to run html2jade under node 0.11.x?

donpark avatar Dec 06 '14 06:12 donpark

I am trying to use this in latest chrome which I suppose has the latest node

skandasoft avatar Dec 06 '14 20:12 skandasoft

sorry but chrome, the browser, does not have node.js inside of it.

donpark avatar Dec 07 '14 01:12 donpark

with atom it does

skandasoft avatar Dec 07 '14 14:12 skandasoft

Yes, Atom uses both Chrome and Node.js. Have you tried running html2jade in the browser? See Programmatic Usage section of the README.md file for example. If you're using tools like browserify, you'll need to add jsdom-little module to the tool's list of modules to ignore.

donpark avatar Dec 07 '14 16:12 donpark

TO THOSE WHO ABSOLUTELY NEED TO RUN HTML2JADE UNDER 0.11:

Try forking and replacing jsdom-lite dependency with jsdom. According to @zxdong262, this makes html2jade run under 0.11.x. Thx.

donpark avatar Jan 25 '15 14:01 donpark

How about then switching away from jsdom-little completely and head over https://github.com/cheeriojs/cheerio?

paazmaya avatar Feb 19 '15 11:02 paazmaya

Cheerio is definitely an option since jsdom-little appears to be abandoned. Only problem is I don't have a desperate need since I can just switch to Node.js 0.10 or use one of several web version. In other words, PR is welcome as long as backward compatibility is maintained to minimize backfire. :-)

donpark avatar Feb 19 '15 11:02 donpark

Working in a PR. Is there are use case when the library is used outside the Node.js context? Since there are things like this:

if module?
  isNode = true

paazmaya avatar Feb 20 '15 09:02 paazmaya

Ah, yes, three AFAIK: bower, browserify, scalate. there might be other browser use-cases that could break.

BTW, let me know if you'd like to be added as a collaborator. This project needs someone would could give it more TLC.

donpark avatar Feb 20 '15 21:02 donpark

Sorry for the silence.

Given the above requirements, it would seem that Cheerio is not the way to go then. I started looking at taking the latest jsdom 3.x in use, since 4.x is only for io.js.

paazmaya avatar Mar 02 '15 14:03 paazmaya

yeah. that was my conclusion last time I looked at Cheerio.

donpark avatar Mar 02 '15 18:03 donpark

For anybody who want to run it on 0.11 or 0.12, you can use my fork for the time being. I just changed jsdom-little to jsdom dependency.

https://github.com/donpark/html2jade/pull/100

"dependencies": {
  "html2jade": "Nedomas/html2jade"
}

Nedomas avatar Aug 10 '15 09:08 Nedomas

Verified that html2jade works with Node.js v4. Reducing bug level to minor.

donpark avatar Dec 29 '15 00:12 donpark