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

Feature Request. Internal css and _nuxt/style.css defer loading #254

Closed
o-alexandrov opened this issue Feb 13, 2017 · 2 comments
Closed
Labels

Comments

@o-alexandrov
Copy link

o-alexandrov commented Feb 13, 2017

Hi,
Please consider simplifying the ability to leave some critical CSS as internal CSS inside head tag:

<head>
....
   <style>....</style>
</head>

For now, adding something that prevents nuxt from building the styles of a component, like ?indentedSyntax=true to the layouts/default.vue allows us to have internal css inside head.

However, we could also defer the load of the compiled _nuxt/style.css, if you set it as Google suggests here
I also copy/paste the part that I ask you to look at:

    <noscript id="deferred-styles">
      <link rel="stylesheet" type="text/css" href="small.css"/>
    </noscript>
    <script>
      var loadDeferredStyles = function() {
        var addStylesNode = document.getElementById("deferred-styles");
        var replacement = document.createElement("div");
        replacement.innerHTML = addStylesNode.textContent;
        document.body.appendChild(replacement)
        addStylesNode.parentElement.removeChild(addStylesNode);
      };
      var raf = requestAnimationFrame || mozRequestAnimationFrame ||
          webkitRequestAnimationFrame || msRequestAnimationFrame;
      if (raf) raf(function() { window.setTimeout(loadDeferredStyles, 0); });
      else window.addEventListener('load', loadDeferredStyles);
    </script>
This feature request is available on Nuxt.js community (#c217)
@o-alexandrov o-alexandrov changed the title Feature Suggest. Internal css and _nuxt/style.css defer loading Feature Request. Internal css and _nuxt/style.css defer loading Feb 14, 2017
@alexchopin
Copy link
Member

Hi, we are aware about it, it's planned for Nuxt 1.0

@lock
Copy link

lock bot commented Nov 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 5, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants