Skip to content

Change position of Livewire Style #1093

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

Merged
merged 2 commits into from
Jul 20, 2022
Merged

Change position of Livewire Style #1093

merged 2 commits into from
Jul 20, 2022

Conversation

syntafin
Copy link
Contributor

Changed the position where the Livewire styles got loaded, from before, to after the Vite injection.
This is to prevent missleading behaivor of Livewire as discussed in the Livewire Discord:
image
image

@driesvints driesvints requested a review from jessarcher July 20, 2022 08:15
@taylorotwell taylorotwell merged commit 805afa2 into laravel:2.x Jul 20, 2022
@timacdonald
Copy link
Member

timacdonald commented Jul 21, 2022

@syntafin can you elaborate on the conflict here? Looking at this, it seems to me that the previous way would be preferred.

The @livewireStyles injects the following CSS, and is an entirely static result.

<style {$nonce}>
    [wire\:loading], [wire\:loading\.delay], [wire\:loading\.inline-block], [wire\:loading\.inline], [wire\:loading\.block], [wire\:loading\.flex], [wire\:loading\.table], [wire\:loading\.grid], [wire\:loading\.inline-flex] {
        display: none;
    }

    [wire\:loading\.delay\.shortest], [wire\:loading\.delay\.shorter], [wire\:loading\.delay\.short], [wire\:loading\.delay\.long], [wire\:loading\.delay\.longer], [wire\:loading\.delay\.longest] {
        display:none;
    }

    [wire\:offline] {
        display: none;
    }

    [wire\:dirty]:not(textarea):not(input):not(select) {
        display: none;
    }

    input:-webkit-autofill, select:-webkit-autofill, textarea:-webkit-autofill {
        animation-duration: 50000s;
        animation-name: livewireautofill;
    }

    @keyframes livewireautofill { from {} }
</style>

Meanwhile, the app.css only injects Tailwinds styles...

@tailwind base;
@tailwind components;
@tailwind utilities;

Based on this, I see it as beneficial to have app.css loaded last to allow you to override the default Livewire styling if you wanted to do so.

Although it probably isn't a big deal as the livewire stuff is really only concerned with hiding things, but would still be good to better understand the problem.

@syntafin
Copy link
Contributor Author

Good day,

when I migrated my project from Mix to Vite, I copied how Livewire and other Styles/Scripts are loaded from a new created project, to ensure nothing is wrong.

After this I saw that the loading state from the searchbar on the page didn't work as expected, because it was always visible, as seen on this screenshot:
unknown-4.png

But this was not the only problem as I found out later when tested on staging environment:
unknown-5.png

Uncaught SyntaxError: Invalid or unexpected token

I asked then on the Livewire Discord if this problem is known, and got the answer as seen in initial PR, after I tested if it works when I place @livewireStyles under Vite as I had before.

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.

3 participants