[EXTENSION] ExtendedClientScript - Reduce your page loading times

same error here.

Mistake at cssmin.php with yii

line 3706


if (class_exists("JSMin") && stripos($token->Value, "expression(") !== false)

after call this line when $combineCss = true

yii tries to load JSMin, but can’t find it and call error.

Fast solution is change line to


if (@class_exists("JSMin") && stripos($token->Value, "expression(") !== false)

nice solution is change ExtendedClientScript.php to load also JSMin if cssmin.php is called.

And question - if i don’t want combine scripts (js or css), just only compress - why this not work?

And suggestion, use feature of cssmin which called ImportImports

change code in method


combineAndCompress

from


if ($this->_renewFile) {

to last } of this if to


		if ($this->_renewFile)

		{

			$this->garbageCollect($type);

			$combinedFile = '';

			$importPath = false;


			foreach ($urls as $key => $file) {

			    $fileContents = file_get_contents($this->basePath.'/'.$file);

			    if ( $type == 'css' && strpos($fileContents, '@import') !== false ) {

				$importPath = dirname($this->basePath.'/'.$file);

			    }


			    if ($type == 'js' && $this->compressJs) {

				$fileContents = $this->minifyJs($fileContents);

			    }


			    if ($type == 'css' && $this->compressCss) {

				$fileContents = $this->minifyCss($fileContents, $importPath);

			    }

			    $combinedFile .= $fileContents;

			}


			file_put_contents($this->filePath.'/'.$fileName, $combinedFile);

		}

this code use combine after minify operations, it some highloaded, but give ability to use importImports

then change method


minifyCss

to


	private function minifyCss($css, $importPath)

	{

	    if ( $this->cssMinFilters['ImportImports'] && $importPath ) {

		$this->cssMinFilters['ImportImports'] = array('BasePath' => $importPath );

	    }

		Yii::import($this->cssMinPath);

		return cssmin::minify($css, $this->cssMinFilters, $this->cssMinPlugins);

	}

Great extension, big thanks for it!

Maxximus: I posted patch http://code.google.com/p/extendedclientscript/issues/detail?id=1 for this extension, please take a look at it.

Hello…

I put the htaccess file on the root of my yii web project which contains mod_headers.

localhost/yiiproject/[here]

But, when I tested in Yslow, it still gave me [color="#FF0000"]add expires header[/color] error

Does anyone know why Yii is like ‘ignoring’ the htaccess rule or just how to resolve errors that is given by Yslow?

thanks