protected function compileFile($lessPath, $cssPath)
	{
		$options = array();

		if ($this->strictImports === true)
			$options[] = '--strict-imports';

		if ($this->compression === self::COMPRESSION_WHITESPACE)
			$options[] = '--compress';
		else if ($this->compression === self::COMPRESSION_YUI)
			$options[] = '--yui-compress';

		if ($this->optimizationLevel !== false)
			$options[] = '-O' . $this->optimizationLevel;

		if (isset($this->rootPath))
			$options[] = '--rootpath ' . $this->rootPath;

		if ($this->relativeUrls === true)
			$options[] = '--relative-urls';

		// 2>&1 at the end redirects STDERR (where error's appear) to STDOUT 
		// (which is returned by shell_exec())
		$nodePath = $this->nodePath? '"' . $this->nodePath . '" ' : '';
		$command = $nodePath . '"' . $this->compilerPath . '" '
			. implode(' ', $options) . ' "' . $lessPath . '" "' . $cssPath . '" 2>&1';

		$return = 0;
		$output = array();
		@exec($command, $output, $return);

		switch ($return) 
		{
			case 2:
			case 1:
				// Replace shell color codes in the output
				$output = preg_replace('/\[[0-9]+m/i', '', implode("\n", $output));
				
				throw new CException(
					'Failed to compile file "' . $lessPath . '" using command: ' . $command . '. The error was: ' . $output);
		}
	}
protected function compileFile($lessPath, $cssPath)
	{
		$options = array();

		if ($this->strictImports === true)
			$options[] = '--strict-imports';

		if ($this->compression === self::COMPRESSION_WHITESPACE)
			$options[] = '--compress';
		else if ($this->compression === self::COMPRESSION_YUI)
			$options[] = '--yui-compress';

		if ($this->optimizationLevel !== false)
			$options[] = '-O' . $this->optimizationLevel;

		if (isset($this->rootPath))
			$options[] = '--rootpath ' . $this->rootPath;

		if ($this->relativeUrls === true)
			$options[] = '--relative-urls';

		// 2>&1 at the end redirects STDERR (where error's appear) to STDOUT 
		// (which is returned by shell_exec())
		$nodePath = $this->nodePath? '"' . $this->nodePath . '" ' : '';
		$command = $nodePath . '"' . $this->compilerPath . '" '
			. implode(' ', $options) . ' "' . $lessPath . '" "' . $cssPath . '" 2>&1';

		$return = 0;
		$output = array();
		@exec($command, $output, $return);

		switch ($return) 
		{
			case 2:
			case 1:
				// Replace shell color codes in the output
				$output = preg_replace('/\[[0-9]+m/i', '', implode("\n", $output));
				
				throw new CException(
					'Failed to compile file "' . $lessPath . '" using command: ' . $command . '. The error was: ' . $output);
		}
	}
protected function compileFile ( $ lessPath , $ cssPath ) { $ options = array ( ) ; if ( $ this -> strictImports === true ) $ options [ ] = '--strict-imports' ; if ( $ this -> compression === self :: COMPRESSION_WHITESPACE ) $ options [ ] = '--compress' ; else if ( $ this -> compression === self :: COMPRESSION_YUI ) $ options [ ] = '--yui-compress' ; if ( $ this -> optimizationLevel !== false ) $ options [ ] = '-O' . $ this -> optimizationLevel ; if ( isset ( $ this -> rootPath ) ) $ options [ ] = '--rootpath ' . $ this -> rootPath ; if ( $ this -> relativeUrls === true ) $ options [ ] = '--relative-urls' ; // 2>&1 at the end redirects STDERR (where error's appear) to STDOUT  // (which is returned by shell_exec()) $ nodePath = $ this -> nodePath ? '"' . $ this -> nodePath . '" ' : '' ; $ command = $ nodePath . '"' . $ this -> compilerPath . '" ' . implode ( ' ' , $ options ) . ' "' . $ lessPath . '" "' . $ cssPath . '" 2>&1' ; $ return = 0 ; $ output = array ( ) ; @ exec ( $ command , $ output , $ return ) ; switch ( $ return ) { case 2 : case 1 : // Replace shell color codes in the output $ output = preg_replace ( '/\[[0-9]+m/i' , '' , implode ( "\n" , $ output ) ) ; throw new CException ( 'Failed to compile file "' . $ lessPath . '" using command: ' . $ command . '. The error was: ' . $ output ) ; } }
Compiles the given LESS file into the given CSS.
@param string $lessPath path to the less file.
@param string $cssPath path to the css file.
@throws CException if the compilation fails.
Compiles the given LESS file into the given CSS .