Magento Forum

   
Inlining print.css into Magento
 
tease
Sr. Member
 
Total Posts:  115
Joined:  2010-10-06
 

Hi everybody,

I am trying to speed up my Magento site (1.7.0.2.) a bit and therefore I want to inline my print.css so there is one less HTTP-Request. I analysed my site on http://www.gtmetrix.com and the site suggested this move.

So how to do it?

I found out that all the external files get loaded by page.xml, which is located in the folder app/design/frontend/default/myTheme/layout/
I hope this info is right.

In this file there is the code:

<action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>

I assume this info is responsible for loading the external css file, right?

So now I changed this line into this:

<style type="text/css">
@
media print{
  
*     { background:none !importanttext-align:left !important}
html  { margin
:!importantpadding:!important}
body  { background
:#fff !important; font-size:9pt !important; padding:0 !important; margin:10px !important; }
a     { color:#2976c9 !important; }
th,td { color:#2f2f2f !important;  border-color:#ccc !important; }
 
.header-container,
.
nav-container,
.
footer-container,
.
pager,
.
toolbar,
.
actions,
.
buttons-set { display:none !important}
 
.page-print .data-table .cart-tax-total { background-position:100% -54px}
.page-print .data-table .cart-tax-info { display:block !important}
}
</style>

But this seems to archieve nothing at all, because when I load my site in the browser the source code still looks like this:

<link rel="stylesheet" type="text/css" href="http://www.meine-website.de/min/?f=/skin/frontend/default/default/css/print.css&amp;1350393629" media="print" />
Furthermore I find the nubers ("amp;1350393629") behind the name print.css kind of strange.

So, which file is responsible for the loading of my external css file? Or am I thinking along the wrong lines? How do you go about doing things like this?

Your help is appreciated! Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
prateekgupta
Guru
 
Avatar
Total Posts:  539
Joined:  2010-06-04
India
 

HI,

I suggest to use this free extension. http://www.magentocommerce.com/magento-connect/fooman-speedster.html It has many great reviews and also have awesome results. Try this, it will help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tease
Sr. Member
 
Total Posts:  115
Joined:  2010-10-06
 

Thanks for the reply.
I looked at the extension and figured that it wouldn’t help me very much, because everthing it offers like combining various css files and browser caching I already did. I don’t think it will help me inline the css.
But thank you anyway.

Any other ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top