twitter bootstrap - Inline minified CSS files between <head> tags rather than HTTP <link> to them -
i have been following , working google pagespeed insights checker. i'm close 100%; , while know suggestions listed in insights check advice, , near based on every need, need know general consensus of placing minified css bundles directly between <style></style>
tags on each page instead of doing 1x <link href=...>
file.
to clarify, saying doing this:
<html> <head> <style> <?php include('/path/to/compiledminified.css'); </style> </head>
which outputs this:
<html> <head> <style> /*! * bootstrap v3.3.7 (http://getbootstrap.com) * copyright 2011-2016 twitter, inc. * licensed under mit (https://github.com/twbs/bootstrap/blob/master/license) *//*! normalize.css v3.0.3 | mit license | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight......... </style> </head>
now google pagespeed insights score goes 81 (yellow) way 96 (green).
the minified css in question has global css styles, fontawesome, bootstrap , couple of other things gulped 1 minified css file.
the downsides of obvious, css won't cached browser, , need downloaded on every page of website between <head>
page. on other hand, pages on site aren't big anyway, , saving http request in increased performance anyway.
but never hear of you? sticking bootstrap etc etc inbetween <style>
tags between <head></head>
tags.
what 'right way' this?
i believe there's no right way it. should never doing inline styles such big files. highly recommend stick external file.
if stick idea though - think there's no better way put in between of
Comments
Post a Comment