Skip to content

[10.x] Use HtmlString in Vite fake#49163

Merged
taylorotwell merged 2 commits into
laravel:10.xfrom
jasonvarga:patch-1
Nov 28, 2023
Merged

[10.x] Use HtmlString in Vite fake#49163
taylorotwell merged 2 commits into
laravel:10.xfrom
jasonvarga:patch-1

Conversation

@jasonvarga

@jasonvarga jasonvarga commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

The change in #49150 has started to break our test suite.

Since that PR, the faked Vite instance now implements Htmlable, so we're now seeing a lot of Call to member function toHtml() on string from this line:

return $this->__invoke($this->entryPoints)->toHtml();

Since toHtml() is expecting __invoke to return an HtmlString, that's what this PR is doing.

We don't use the @vite directive (the error doesn't happen if you do). We use the facade essentially like this:

{{ Vite::withEntryPoints(['path/to/file.css']) }}

For the test I just slapped on ->toHtml() the same way you do that in https://github.com/laravel/framework/blob/10.x/tests/Foundation/FoundationViteTest.php

@jasonvarga jasonvarga changed the title Use HtmlString in Vite fake [10.x] Use HtmlString in Vite fake Nov 28, 2023
@jasonvarga

Copy link
Copy Markdown
Contributor Author

Thanks for the quick turnaround.

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.

2 participants