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

Ability to prevent CSS from being extracted from the manifest #58

Closed
JshGrn opened this issue Feb 9, 2023 · 1 comment
Closed

Ability to prevent CSS from being extracted from the manifest #58

JshGrn opened this issue Feb 9, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@JshGrn
Copy link

JshGrn commented Feb 9, 2023

Is your feature request related to a problem? Please describe.

The problem is a FOUC due to the order of the files and position of the files in the template, the FOUC is due to the stylesheet being loaded at the end of the body. I need to be able to only output script there and inject the css in the head once.

Right now I can use craft.vite.asset('app.css') to inject into the head which solves this problem, but there is a duplicate entry at the bottom of the page.

Describe the solution you would like

I would like to be able to specify as an option to skip processing CSS files in the vite.php config, this could read the config and just not execute the part of the extractManifestTags function where it is calling self::extractCssFiles(self::$manifest, $manifestKey, $cssFiles);

Describe alternatives you have considered

Forking the project

Additional context

None needed, CSS is being injected in bottom of page with script tags with no ability to remove.

@JshGrn JshGrn added the enhancement New feature or request label Feb 9, 2023
@khalwat
Copy link
Contributor

khalwat commented Feb 9, 2023

There will be no duplicate entry if you include the CSS as one of the entrypoints from your vite.config.ts rather than importing it via Javascript

See the discussion here: #31

There also would be no FOUC if you used the Critical CSS pattern

@khalwat khalwat closed this as completed Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants