Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First line is blank #1913

Open
thasmo opened this issue Mar 29, 2015 · 8 comments
Open

First line is blank #1913

thasmo opened this issue Mar 29, 2015 · 8 comments

Comments

@thasmo
Copy link

thasmo commented Mar 29, 2015

Converting the following jade template with gulp-jade results in the HTML file having a blank, first line:

link(rel='import', href='../../polymer/polymer.html')

polymer-element(name='my-element', attributes='attribute')
    template
    script(src='my-element.js')

Not sure if this depends on the source file or if this is a general minor jade glitch, but it would be nice to get rid of the blank line.

Any ideas? Thanks!

@TimothyGu
Copy link
Member

Unfortunately I do not think this is a bug in Jade. At least with Jade 1.9.2 it is not reproducible:

$ cat <<EOF | bin/jade.js 
link(rel='import', href='../../polymer/polymer.html')

polymer-element(name='my-element', attributes='attribute')
    template
    script(src='my-element.js')
EOF
<link rel="import" href="../../polymer/polymer.html"/><polymer-element name="my-element" attributes="attribute"><template></template><script src="my-element.js"></script></polymer-element>

@TimothyGu
Copy link
Member

Scratch that.

@TimothyGu
Copy link
Member

Hm WTF I can't reproduce it now.

@thasmo
Copy link
Author

thasmo commented Mar 30, 2015

Hehe, I don't understand. ;) So, this may be more likely a gulp or gulp-jade bug?

@ForbesLindesay
Copy link
Member

I'd be extremely surprised if this is a current jade bug. This is almost certainly a bug in gulp-jade. The other possibility is that you're using a very old version of jade, it used to be extremely buggy. If you can reproduce it by calling jade directly (or via the CLI), please comment and we will re-open.

@finico
Copy link

finico commented Aug 30, 2015

@ForbesLindesay @thasmo I can reproduce it

> jade --version
1.11.0
> echo ".some" > ./template.jade
> jade ./template.jade --pretty

  rendered template.html

> cat template.html

<div class="some"></div>
> sed -n '$=' ./template.html
2
>

the same result on mac os and ubuntu server

@TimothyGu TimothyGu reopened this Aug 30, 2015
@TimothyGu
Copy link
Member

Seems like this issue is related to pretty mode.

@TimothyGu
Copy link
Member

Yes I can reproduce it now. The problem is pretty difficult to fix, since we always insert a new line before a block-level tag (if you try doctype html or span a they don't have an extra new line). We need to add a flag in the Compiler object in jade-code-gen for determining whether or not we should add the new line, but this won't be accurate as we have mixins etc.

@TimothyGu TimothyGu mentioned this issue Sep 6, 2015
@ForbesLindesay ForbesLindesay added this to the 4.0.0 - Pretty Printing milestone Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants