bdkjones / CodeKit

CodeKit 3 Issue Tracker
https://codekitapp.com
82 stars 5 forks source link

Pug/Jade: Jade isn't compiling properly when imported, pug does; variables aren't interpolated correctly for pug and jade #60

Closed subhaze closed 8 years ago

subhaze commented 8 years ago

Quick, short summary: When using .jade and doing an include somefile.jade that file is included, however, it is not properly compiled and injected into the output HTML as uncompiled jade. The bits in the main .jade file are compiled though.

Expected results: The imported .jade files to be compiled as well.

Actual results: The imported .jade files are not compiled.

Exact steps to reproduce: Create a index.jade file and an other.jade file.

In main.jade do something like:

index.jade

div some test here, this will be wrapped in a proper <div/>
import other.jade

other.jade

div
  p this wont be wrapped properly

index.html

<div>some test here, this will be wrapped in a proper <div/></div>
p this wont be wrapped properly

A link to download a simplified project or file that shows the issue:

Your configuration (any details about your system that you think might be relevant)

subhaze commented 8 years ago

Looks like variable interpolation is broken as well :/

https://github.com/subhaze/ck3_test1/releases/tag/issue-%2360

https://github.com/subhaze/ck3_test1/tree/issue/jade-pug

subhaze commented 8 years ago

If there's any more I can do to help move this forward let me know, I've had to punt on using beta 2 for most of my work since I'm in two projects heavy with .jade :/

I'll still def be evaluating it on other things when I can throughout the week.

bfkss commented 8 years ago

also output HTML-files won't be shown in CK unless you do a manual refresh or an other file (like JS) triggers an output file, which causes a refresh

edit: the HTML file is not marked as 'output' in CK, if it's in the same folder

bdkjones commented 8 years ago

Does this work as expected in CodeKit 2? If so, the issue is the new Pug compiler. You’d have THOUGHT that the Jade people would just be changing the name, not re-writing the whole thing…

On 25 May 2016, at 07:25, Michael Russell notifications@github.com wrote:

Quick, short summary: When using .jade and doing an include somefile.jade that file is included, however, it is not properly compiled and injected into the output HTML as uncompiled jade. The bits in the main .jade file are compiled though.

Expected results: The imported .jade files to be compiled as well.

Actual results: The imported .jade files are not compiled.

Exact steps to reproduce: Create a index.jade file and an other.jade file.

In main.jade do something like:

index.jade

div some test here, this will be wrapped in a proper

import other.jade other.jade

div p this wont be wrapped properly index.html

some test here, this will be wrapped in a proper

p this wont be wrapped properly A link to download a simplified project or file that shows the issue:

Your configuration (any details about your system that you think might be relevant)

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/bdkjones/codekit3/issues/60

subhaze commented 8 years ago

Yeah, works fine on CK2 and worked fine (aside from the .pug issue) in CK3 beta 1. It's been my main project I've battle tested CK3 beta with, which was initially on CK2.

bdkjones commented 8 years ago

Try renaming every .jade file to .pug and compiling with Beta 3. Maybe the Pug compiler just can’t handle *.jade files.

On 25 May 2016, at 11:21, Michael Russell notifications@github.com wrote:

Yeah, works fine on CK2 and worked fine (aside from the .pug issue) in CK3 beta 1. It's been my main project I've battle tested CK3 beta with, which was initially on CK2.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/bdkjones/codekit3/issues/60#issuecomment-221661770

subhaze commented 8 years ago

Damn, I didn't realize beta-3 was out...

For what it's worth, I did that with beta-2 and it was a no go. But i'll give this a shot on beta-3

subhaze commented 8 years ago

Just to follow up with that. renaming everything to .pug fixes the issue of not compiling imports, however, I'm left with the issue where variables aren't interpolated and it literally pushes out the var declaration and not its value.

Giving the spec/docs a quick read earlier nothing seemed to have changed in that area, unless a change on how it handles variables is buried in a change.log somewhere...

subhaze commented 8 years ago

So, found an issue on their repo. Looks like this wont be an easy move to pug. At least right now.

https://github.com/pugjs/pug/issues/2305

There's some BC from jade -> pug and there's a known issue about the import of .jade files not working.

This also covers the interpolation issues i was having. So "techincally" all is working correctly in CK3 beta, I should've done better homework/research on it.

I guess the big questions is managing expectations for ppl moving to CK3 that have lots of investment in .jade.

bdkjones commented 8 years ago

Oh dear Christ. That really throws an huge wrench into supporting Jade/Pug in CodeKit. I had been operating under the assumption that the two were interchangeable.

subhaze commented 8 years ago

IMO, they should've been... but i guess they took this opportunity to clean out some old baggage...

bdkjones commented 8 years ago

This is what I love about Sass. Sass never does this. It never yanks the rug out from under you. You get a long, drawn-out deprecation process and support for older syntax. Pug has just said, "Fuck it; all that old stuff doesn't work anymore."

bfkss commented 8 years ago

as for the refreshing and marking the output file in the same folder: this works in CK2 with .jade

but as you already mentioned: they changed quite a lot in Pug (a.k.a Jade 2.0)

subhaze commented 8 years ago

@bdkjones thoughts on punting on pug for the moment, especially since it's still alpha and has BC involved in upgrading?

bdkjones commented 8 years ago

Nah, it's where the puck is going. I'll just include the jade compiler and call it for any jade files. Folks just can't mix and match pug as I thought they could. I get that pug is a new thing, but changing the language without any deprecation process is a really hostile move. It encourages people to not adopt the language because it might just mutate at any time, leaving them with broken stuff. I would have handled this a bit different if I were the jade team.

Sent from my iPhone

On May 25, 2016, at 13:43, Michael Russell notifications@github.com wrote:

@bdkjones thoughts on punting on pug for the moment, especially since it's still alpha and has BC involved in upgrading?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

subhaze commented 8 years ago

OK cool, and yeah completely agree, took me by surprise.

bdkjones commented 8 years ago

Fixed for Beta 4 (I think). Jade files will call the Jade compiler, Pug files will call the Pug compiler and never the two shall meet.

Jade files are still referred to as Pug files in the UI, however. I've added Pug/Jade to project settings to indicate that they are both covered by that settings pane. This will persist until Pug and Jade no longer have the same option set. At that point, support for *.jade files will be dropped completely and CodeKit will recognize and compile only Pug.

If you use Jade, I'd start working on migrating.

subhaze commented 8 years ago

Cool, ill run a couple of projects in Jade through this and convert one over to pug and see how that goes.

subhaze commented 8 years ago

Just checked my project that was breaking when using jade, in Beta 2-3, can confirm that Beta 4 fixes issues I was seeing.

I'll convert to pug a bit later and see how that goes.