Closed JshGrn closed 1 year ago
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: https://github.com/nystudio107/craft-vite/issues/31
There also would be no FOUC if you used the Critical CSS pattern
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.