Yii is rewriting src paths?

Just noticed something weird. I noticed it while investigating css not being refreshed (almost like a cache control error). In my layout, I’ve coded stylesheets and scripts the usual way;




<link rel="stylesheet" type="text/css" href="/css/screen.css" media="screen, projection" />

<link rel="stylesheet" type="text/css" href="/css/print.css" media="print" />

<!--[if lt IE 8]><link rel="stylesheet" href="/css/ie.css" type="text/css" media="screen, projection" /><![endif]-->

<link rel="stylesheet" type="text/css" href="/themes/desktop/css/site.css" media="screen, projection" />

<script type="text/javascript" src="/scripts/modernizr/modernizr.js"></script>

<script type="text/javascript" src="/themes/desktop/scripts/desktop.script.js"></script>



However, when viewing the rendered HTML I get the following…





<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8"/>

<style>/**

 * CSS styles for CLinkPager.

 *

 * @author Qiang Xue <qiang.xue@gmail.com>

 * @link http://www.yiiframework.com/

 * @copyright Copyright &copy; 2008-2010 Yii Software LLC

 * @license http://www.yiiframework.com/license/

 * @version $Id: pager.css 1678 2010-01-07 21:02:00Z qiang.xue $

 * @since 1.0

 */

 

ul.yiiPager

{

	font-size:11px;

	border:0;

	margin:0;

	padding:0;

	line-height:100%;

	display:inline;

}

 

ul.yiiPager li

{

	display:inline;

}

 

ul.yiiPager a:link,

ul.yiiPager a:visited

{

	border:solid 1px #9aafe5;

	font-weight:bold;

	color:#0e509e;

	padding:1px 6px;

	text-decoration:none;

}

 

ul.yiiPager .page a

{

	font-weight:normal;

}

 

ul.yiiPager a:hover

{

	border:solid 1px #0e509e;

}

 

ul.yiiPager .selected a

{

	background:#2e6ab1;

	color:#FFFFFF;

	font-weight:bold;

}

 

ul.yiiPager .hidden a

{

	border:solid 1px #DEDEDE;

	color:#888888;

}

 

/**

 * Hide first and last buttons by default.

 */

ul.yiiPager .first,

ul.yiiPager .last

{

	display:none;

}</style> 

<script type="text/javascript" src="http://www.example.org/assets/793edc52/jm.13b1dc3efc8931fb7a60fc4268ee0907.jquery,l.js"></script> 

<script type="text/javascript" src="/assets/793edc52/jquery.ba-bbq.js"></script> 

<script type="text/javascript" src="/assets/f62097ad/gridview/jquery.yiigridview.js"></script> 

<title>My Web Application - Site</title>


<!-- blueprintcss -->

<link rel="stylesheet" type="text/css" href="http://www.example.org/css/ce.ce0c38d24298a34221c10ede5bab66a4.screen,s.css" media="screen, projection"/>

<link rel="stylesheet" type="text/css" href="http://www.example.org/css/ce.d1bd2440511227355570735e3392f798.print,s.css" media="print"/>

<!--[if lt IE 8]><link rel="stylesheet" href="/css/ie.css" type="text/css" media="screen, projection" /><![endif]-->

<link rel="stylesheet" type="text/css" href="http://www.example.org/themes/desktop/css/ce.46cbb95d2343457b5a2cdffabf46c29b.site,s.css" media="screen, projection"/>


<link rel="stylesheet" type="text/css" href="http://www.example.org/scripts/selectbox/ce.9943125a3e0b93452668bf74eef7c02a.selectbox,s.css" media="screen"/>

<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;sensor=false&amp;key=ABQIAAAAApEPq1opMd2jd6fQyoC3GhRx5Lx871-Gs_2Crvdy394GY4FmYxR88vVlPQDb74XpBhMgkdbPBu7a1g"></script>

<script type="text/javascript" src="/scripts/modernizr/modernizr.js"></script>

<script type="text/javascript" src="/themes/desktop/scripts/desktop.script.js"></script>

<script type="text/javascript" src="/scripts/selectbox/jquery.selectbox.js"></script>



As you can see, the paths have been rewritten and the contents of YiiPager css is written into the head. They still work, but it’s out of date i.e. if I make changes and hit refresh, the expected changes don’t appear.

Anyone else experienced this?

I’m on Ubuntu and tested it with Chrome and Firefox - same result.

phew! I just solved it. I remembered I installed mod_pagespeed late last night (http://code.google.com/speed/page-speed/docs/module.html). It seems as this is normal behaviour for the module to speed up the loading of resources. Panick over!

Just learned about this module today. What it did to your page looks quite odd to me. I wonder how they really make sure, that everything still works. Dependencies of CSS and js can be quite complex. But i think i’ll give it a try, too.