Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: Re: Google developers pagespeed insights - can't optimize css Date: Sat, 16 May 2015 02:03:01 +0200 Organization: solani.org Lines: 32 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: solani.org 1431734571 15700 eJwFwQkRADAIAzBLox3P5AAH/iUsUZpY+zW1q6ubPsx5K4ThoHzZpY7xEOkSJBB5rMgXAXwYSBBg (16 May 2015 00:02:51 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 16 May 2015 00:02:51 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 X-User-ID: eJwNyskBwCAIBMCW3HCt5YBg/yWYeY+Jw0+om6tdu9guGjrNzm2VlRwU2z9Cs4P/ONJrEAtr+AAdxREF In-Reply-To: Cancel-Lock: sha1:JGgcKOHmxEDa6gfOAFg1hT5zI1s= X-NNTP-Posting-Host: eJwNyskRADEIA8GUwAixTscc+YewPKdr3KjMAJ3w8ZHapgq/6r6ZBHghWQJjnNcLsV+Nip16PwkhEKM= Xref: csiph.com comp.lang.javascript:27656 lazar@convexicon.com wrote: > On Saturday, May 16, 2015 at 2:31:47 AM UTC+3, Christoph M. Becker wrote: > >> lazar@convexicon.com wrote: >> >>> "Eliminate render-blocking JavaScript and CSS in above-the-fold >>> content Your page has 1 blocking CSS resources. This causes a delay >>> in rendering your page." >> >> A blocking CSS resource? o_O > > Here's what I tried: > > $(window).load(function() { > $('head').append(''); > }) If I'm not mistaken, a linked CSS resource should never block, but rather be downloaded, parsed and applied asynchronously. That's contrary to any client side script resources (e.g. JavaScript resources), which have to be blocking (unless explicitly stated) due to potentially writing to the document (e.g. document.write()). Adding a link element on window load doesn't seem to be a good idea, because you're risking a FOUC this way. Anyhow, it might be best if you can post a link to the site – the "finer details" might matter. -- Christoph M. Becker