Skip to content

Conversation

@taylorotwell
Copy link
Member

@taylorotwell taylorotwell commented Jan 13, 2021

Fixes #35866

This feels a bit hacky but is the simplest solution I can think of that works. 🤷

@GrahamCampbell GrahamCampbell changed the title Fix extra space on blade class components that are inline [8.x] Fix extra space on blade class components that are inline Jan 13, 2021
@taylorotwell taylorotwell merged commit 83ec510 into 8.x Jan 14, 2021
@taylorotwell taylorotwell deleted the blade-component-spacing branch January 14, 2021 14:30
@timrspratt
Copy link
Contributor

@taylorotwell I'm facing the same issue but my IDE adds the empty line to the component blade file.

I'm wondering if there is something similar that can be done with a directive?

I've just experimented with this:

Blade::precompiler(fn ($value) => preg_replace('/@withdraw\n/', '', $value));

It works, but I don't have too much knowledge of the compiler to be aware of the drawbacks. It also would be nice to compile the directive into ##LINE-WITHDRAW## and then replace?

@amiranagram
Copy link
Contributor

@timrspratt this is how I solved it:

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[/resources/views/components/a.blade.php]
insert_final_newline = false

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

Successfully merging this pull request may close these issues.

Extra space when using annonymous component

4 participants