-
Notifications
You must be signed in to change notification settings - Fork 159
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
Unwanted newline #81
Comments
The code causing the above is https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/directive_processor.rb#L80 |
I suppose you could trim it in handlebars_assets as well, but that might also cause unexpected results (in certain cases). This is probably a really rare case though. why not just do |
I agree that adding specific markup in a template may bypass the problem. But the thing here is that the template source is altered in a way that the same template source would yield different output when compiled in the browser. |
So... I would love to just strip the whitespace, however in the case that someone ACTUALLY wants the whitespace then it would break that case... I also do not want to re-grab the body that tilt has already grabbed... hmmm this will plague all template compilers. However there is a simple work-around in the case the user wants the whitespace (add two-newlines). @zorbash, Agree with the trim at most one new-line approach? |
@AlexRiedler Yes, if someone (for compatibility reasons perhaps) still wants the extra newline, two newlines should be inserted for this newline to be appended. Are you on it? |
Yup, on it! (I think it may already be done on my branch; but still needs some verification with how HAML and SLIM works in this case). |
When using the require directive to embed a template file in another file the initial template source is altered (a newline is appended).
It may seem harmless but it may cause undesired and visible effects.
Example.
In the example above the text node will be
instead of
"no newline after this phrase"
We have currently decided to trim the compiled template output before using it with text nodes. But is there another way around?
The text was updated successfully, but these errors were encountered: