donpark / html2jade

Converts HTML to Jade template. Not perfect but useful enough for non-daily conversions.
MIT License
1.18k stars 157 forks source link

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

Open resistdesign opened 9 years ago

resistdesign commented 9 years ago

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 commented 9 years ago

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

donpark commented 9 years ago

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.

skandasoft commented 9 years ago

any updates on this

donpark commented 9 years ago

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?

skandasoft commented 9 years ago

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

donpark commented 9 years ago

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

skandasoft commented 9 years ago

with atom it does

donpark commented 9 years ago

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 commented 9 years ago

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.

paazmaya commented 9 years ago

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

donpark commented 9 years ago

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. :-)

paazmaya commented 9 years ago

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
donpark commented 9 years ago

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.

paazmaya commented 9 years ago

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.

donpark commented 9 years ago

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

Nedomas commented 9 years ago

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"
}
donpark commented 8 years ago

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