Merge branch 'normalized-urls' of https://github.com/rjgotten/less.js into 1.5.0-wip

Conflicts:
	test/css/static-urls/urls.css
	test/css/urls.css
This commit is contained in:
Luke Page
2013-09-01 18:17:32 +01:00
6 changed files with 50 additions and 11 deletions

View File

@@ -87,6 +87,33 @@
return !/^(?:[a-z-]+:|\/)/.test(path);
};
tree.evalEnv.prototype.normalizePath = function( path ) {
var
segments = path.split("/").reverse(),
segment;
path = [];
while (segments.length !== 0 ) {
segment = segments.pop();
switch( segment ) {
case ".":
break;
case "..":
if ((path.length === 0) || (path[path.length - 1] === "..")) {
path.push( segment );
} else {
path.pop();
}
break;
default:
path.push( segment );
break;
}
}
return path.join("/");
};
//todo - do the same for the toCSS env
//tree.toCSSEnv = function (options) {
//};