Update lib/less/browser.js

Add support to "file:///" url which could be useful using "--disable-web-security" without a web server.
This commit is contained in:
cahnory
2013-02-12 10:55:39 +01:00
committed by Luke Page
parent d70769bfb7
commit 8ef5043b78

View File

@@ -200,7 +200,7 @@ function extractUrlParts(url, baseUrl) {
// urlParts[4] = filename
// urlParts[5] = parameters
var urlPartsRegex = /^((?:[a-z-]+:)?\/\/(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/,
var urlPartsRegex = /^((?:[a-z-]+:)?\/+(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/,
urlParts = url.match(urlPartsRegex),
returner = {}, directories = [], i, baseUrlParts;
@@ -313,7 +313,7 @@ function loadStyleSheet(sheet, callback, reload, remaining) {
}
function extractId(href) {
return href.replace(/^[a-z]+:\/\/?[^\/]+/, '' ) // Remove protocol & domain
return href.replace(/^[a-z-]+:\/+?[^\/]+/, '' ) // Remove protocol & domain
.replace(/^\//, '' ) // Remove root /
.replace(/\.[a-zA-Z]+$/, '' ) // Remove simple extension
.replace(/[^\.\w-]+/g, '-') // Replace illegal characters