I've been reading many articles lately about SEO on load times. Trying to get the perfect load time can be quite time-consuming but also a good feeling when you see your site loading twice as quick.

Now a lot of these tutorials and blogs are saying to put chunks of CSS/JS in you head tag to help above-the-fold content to load faster.

"external resources take longer to load", each request back to the server for a file takes more time. So would it not make sense to actually just embed all CSS/JS in your head tag from the beginning.

Sure this could look messy at first, but the only reason why it takes long for external scripts to download in the browser is because the output has already been sent to the browser.

What if we simply do:

    ... Usual things here ...
    <?php require('css/bootstrap'); ?>
    <?php require('css/mystylesheet'); ?>
    ... Usual things here ...
    <?php require('js/bootstrap.js'); ?>
    <?php require('js/myscript.js'); ?>

Now this will just be served as a simple HTML file with embedded CSS and JavaScript as soon as it hits the users browser. And it is just as clean looking in our text editor as before because we require the file in PHP.

Would this improve overall speed performance or should i stay clear of this method?

  • Just curious: why do you load the CSS and JS files with a PHP require? That's the worst practice i've ever seen.
    – Kevin
    Jun 2, 2016 at 5:22
  • I don't ... I said 'what if we simply do'. Jun 2, 2016 at 7:38

2 Answers 2


This question might belong in Stackoverflow and not here but you are including the complete stylesheets and scripts in each of your pages. That increases the download and computation time for each page significantly while the recommendation you speak of is only talking about less significant amounts of styling and code. Doing what you show can increase your page download size perhaps 10x or more.

Imagine trying to load all your markup, styling and code while on a phone with a bad connection. Lots of sites can barely function serving up HTML and basic CSS, much less all that.

What the suggestion is trying to do is get you to provide a minimal amount of markup to make the initial user experience usable as quickly as possible so you can add all the other fluff later.

Now, is this time consuming and difficult? Yep. Depending on the site.

  • Thanks for the reply! I was just wondering if it could be more quick, as it would have to download them all separately anyway after the HTML is loaded. May 31, 2016 at 11:47

As far as i know "load time" don't have much inpact on SEO ( at least for now). Of course that you shoud do whatever you can , to make website faster, but remember that UX is the key ( not technical details that only google robot will see)


  • make your css and js cachable ( using .htaccess for example)
  • combine and minimize your js/css - look for thing called "gulp" (or if you are good in php - look for assetic bundle from symfony )
  • 90% of users leave if site doesn't load with 1 second. And yes loading times affects your serps. Page speed insight is mostly geared towards making sight load faster.
    – Abu Nooh
    Jun 1, 2016 at 10:04
  • where did you get that data ? i can show you site that load 3 sec ,and have bounce rate below 30%
    – Michał G
    Jun 1, 2016 at 14:21
  • Imagine how low your bounce rate will be if you get it to load faster than 3 seconds. Read the first paragraph of this article: semrush.com/blog/why-does-page-speed-impact-your-seo
    – PhillipC
    Jun 2, 2016 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.