inline-source icon indicating copy to clipboard operation
inline-source copied to clipboard

Do not parse tags like <link href="..." rel="preload" as="style"> and <link href="..." rel="preload" as="script">

Open cromatikap opened this issue 5 years ago • 1 comments

Hello,

I want to parse an html file from a vuejs project build:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="icon" href="favicon.ico">
    <title>vue-playground</title>
    <link href="css/app.ef4263c7.css" rel="preload" as="style">
    <link href="js/app.bd8c8303.js" rel="preload" as="script">
    <link href="js/chunk-vendors.52add7a9.js" rel="preload" as="script">
    <link href="css/app.ef4263c7.css" rel="stylesheet">
  </head>
  <body>
    <noscript>
      <strong>
        We're sorry but vue-playground doesn't work properly without JavaScript enabled. Please enable it to continue.
      </strong>
    </noscript>
    <div id="app"></div>
    <script src="js/chunk-vendors.52add7a9.js"></script>
    <script src="js/app.bd8c8303.js"></script>
  </body>
</html>

Is it possible to parse <link href="..." rel="preload" as="style"> (stylesheet) and <link href="..." rel="preload" as="script"> (javascript) in the future? Perhaps I can try a PR on this, what do you think?

cromatikap avatar Jan 02 '21 15:01 cromatikap

It would certainly be possible. Right now, rel="preload" is skipped only because we only look for "stylesheet" and "icon". I'm not really a fan of "inline everything" (and regret adding that feature), but I'm guessing you can't add the inline attribute because these are generated by Vue? I suppose preload is also a good signal for optimisation.

popeindustries avatar Feb 02 '21 07:02 popeindustries