prevent loading global style entry css file
See original GitHub issueWe now have styles inlined in the page (https://github.com/nuxt/framework/pull/7160), and we’ve switched the global CSS file to a non-blocking prefetch. However, the vite preloader does still add these styles to the page, and we can probably avoid this (or have an option to avoid this).
Note: this may be unfeasible as entry.css
may include more CSS than is inlined in the page, and be necessary for subsequent navigation. See https://github.com/nuxt/framework/issues/7623 for example.
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:11 (5 by maintainers)
Top Results From Across the Web
How to configure global css and sass stylesheet with webpack ...
I finally make it work. So here is the changes I made: 1) The path to style.css is now ignored in css/scss clauses....
Read more >css-loader | webpack - JS.ORG
file.js import css from "file.css";. webpack.config.js ... Styles can be locally scoped to avoid globally scoping styles. The syntax :local(.
Read more >How to configure CSS Modules for webpack - LogRocket Blog
Increase the flexibility of your app's CSS components with CSS Modules and Webpack in this handy tutorial and demo app build.
Read more >How to configure CSS and CSS modules in webpack
The first thing we are going to do is to add a styles.css file in the project. ... When css-loader sees this line,...
Read more >Angular Global CSS styles - TekTutorialsHub
We will also learn how to add custom CSS files & external style sheet to angular application.. Table of Contents. Example Application; Adding ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This change depends on JavaScript to load styles. Therefore, generated builds don’t load this CSS file and styling breaks when JS is disabled. Can you take another look at another possible solution that doesn’t require JavaScript to be enabled to make sites look like they should? 😄
Also, when JavaScript is enabled, there’s a flash of unstyled elements with this solution. It doesn’t look nor feel right!
@danielroe below are two URLs.
Old URL (without our hook) and this new URL (with our hook). Both URLs have exact same code except the hook above.
The way entry.css is added is still a blocking request (at least in Chrome).
<link rel="prefetch stylesheet" href="/_nuxt/entry.c5c3adc4.css">
We may modify it as follows (source)
<link rel="stylesheet" href="/_nuxt/entry.c5c3adc4.css" media="print" onload="this.media='all'; this.onload=null;">
I can’t find source but I have read somewhere that above might interfere with Content Security Policy (CSP). I am not sure about proper solution for this but if the css continues to be blocking, inline css is useless. Alternately, we might try adding css to early hints.