MDL-51530 libraries: Upgrade less.php to 1.7.0.9

This commit is contained in:
Damyon Wiese
2015-10-02 05:03:40 +00:00
committed by Ryan Wyllie
parent fd57d685c7
commit df09876082
11 changed files with 477 additions and 97 deletions
+20 -8
View File
@@ -91,13 +91,9 @@ class Less_SourceMap_Generator extends Less_Configurable {
$this->encoder = new Less_SourceMap_Base64VLQ();
$this->SetOptions($options);
// fix windows paths
if( !empty($this->options['sourceMapRootpath']) ){
$this->options['sourceMapRootpath'] = str_replace('\\', '/', $this->options['sourceMapRootpath']);
$this->options['sourceMapRootpath'] = rtrim($this->options['sourceMapRootpath'],'/').'/';
}
$this->options['sourceMapRootpath'] = $this->fixWindowsPath($this->options['sourceMapRootpath'], true);
$this->options['sourceMapBasepath'] = $this->fixWindowsPath($this->options['sourceMapBasepath'], true);
}
/**
@@ -167,7 +163,8 @@ class Less_SourceMap_Generator extends Less_Configurable {
*/
protected function normalizeFilename($filename){
$filename = str_replace('\\', '/', $filename);
$filename = $this->fixWindowsPath($filename);
$rootpath = $this->getOption('sourceMapRootpath');
$basePath = $this->getOption('sourceMapBasepath');
@@ -350,4 +347,19 @@ class Less_SourceMap_Generator extends Less_Configurable {
return $this->source_keys[$filename];
}
/**
* fix windows paths
* @param string $path
* @return string
*/
public function fixWindowsPath($path, $addEndSlash = false){
$slash = ($addEndSlash) ? '/' : '';
if( !empty($path) ){
$path = str_replace('\\', '/', $path);
$path = rtrim($path,'/') . $slash;
}
return $path;
}
}