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

duplicate stylesheet link #242

Closed
riazahmadshigri opened this issue Aug 31, 2023 · 5 comments
Closed

duplicate stylesheet link #242

riazahmadshigri opened this issue Aug 31, 2023 · 5 comments

Comments

@riazahmadshigri
Copy link

riazahmadshigri commented Aug 31, 2023

Vite Plugin Version

0.7.2

Laravel Version

10

Node Version

1.1

NPM Version

8.1.4

Operating System

win

OS Version

10

Web browser and version

google chrome

Running in Sail?

No

Description

//vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig( {
plugins: [
laravel( {
input: [
'resources/css/app.css',
'resources/css/frontend.scss',
'resources/js/app.js',
],
refresh: true,
} ),
],
} );

//header.blade.php

@Vite('resources/css/frontend.scss')

///////its producing dublicate css

Capture

Steps To Reproduce

unknown

@driesvints
Copy link
Member

Does this also happen on v0.8.0?

@riazahmadshigri
Copy link
Author

i don,t know my website is in production i realized it today and even i cannot test it with v8

@driesvints
Copy link
Member

Please try again with v0.8 and report back, thanks.

@timacdonald
Copy link
Member

timacdonald commented Aug 31, 2023

@riazahmadshigri one of these is a "preload" tag the other is a "stylesheet" tag. This is intentional.

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload

@riazahmadshigri
Copy link
Author

riazahmadshigri commented Sep 1, 2023

Yes I added custom attributes on stylesheet for better speed

But the link with preload is duplicate it should not be there

Because I added custom attributes following Laravel docs .....

Before adding those custom attributes it was rendering two similar stylesheets links with rel preload

But now it is supposed to only render the link with custom attr which is correct one
But unfortunately that is not happening

As a workaround I will for now remove @Vite(assets/etc)

And hard code the stylesheet link
I think that's the only solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants