-4

If I understand Google encourages to put the css and javascript in the same page that the html. Internal css but not inline. On the other side, all the manuals and tutorials I have read say that I should use an external document.

Where should I put the css and javascript?

Note: in the design o my page there it makes no difference to use the css and javascript of the "above the folder" internal and the rest external. 90% or more of the css and javascript is for the content above the folder. In my case, it makes no sense make a distinction.

https://developers.google.com/speed/pagespeed/insights/ Resources are blocking the first paint of your page. Consider delivering critical JS/CSS inline and deferring all non-critical JS/styles

https://developers.google.com/web/tools/lighthouse/audits/critical-request-chains

Nrc
  • 9,577
  • 17
  • 67
  • 114
  • 1
    Can you tell us what led you to the conclusion in your first sentence? – Manos Kounelakis Nov 12 '18 at 16:22
  • 1
    Possible duplicate of [When should I use Inline vs. External Javascript?](https://stackoverflow.com/questions/138884/when-should-i-use-inline-vs-external-javascript) – Peter B Nov 12 '18 at 16:26
  • @Mano Kounelakis. I updated the question with the Google links that led me to that conclusion – Nrc Nov 12 '18 at 16:29

1 Answers1

1

There is marginal performance improvement in combining html, css, and javascript in a single document. This theoretical performance boost is outweighed by the many complicating factors that come from trying to do this. You might be saving 20-40ms by combining documents, which is generally not something the end user can detect. You will find more important performance improvements in many other ways.

Merging documents, when done at all, should be acccomplished by using a server-side assembly process so that your code can be well partitioned and well maintained. An example of this is webpack.

But again, unless there is some specialized use case that makes this important, it is not standard practice.

Blunt Jackson
  • 616
  • 4
  • 17