Permalink
Browse files

Safer way to get the css name from a less path

  • Loading branch information...
1 parent fa9d64e commit b3e4e1fabed3031f70aa8541340106a962d282be @vicb vicb committed Jul 5, 2010
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/less/sfLESS.class.php
View
8 lib/less/sfLESS.class.php
@@ -122,11 +122,9 @@ public function findLessFiles()
*/
public function getCssPathOfLess($lessFile)
{
- return str_replace(
- array($this->config->getLessPaths(), '.less'),
- array($this->config->getCssPaths(), '.css'),
- $lessFile
- );
+ $file = preg_replace('/\.less$/', '.css', $lessFile);
+ $file = preg_replace(sprintf('/^%s/', preg_quote($this->config->getLessPaths(), '/')), $this->config->getCssPaths(), $file);
+ return $file;
}
/**

0 comments on commit b3e4e1f

Please sign in to comment.