Fixed dot in css name error(when using style.1.css and style.2.css), also fixed 'url()' error

This commit is contained in:
Fedor Indutny
2010-07-16 14:20:58 +08:00
committed by Alexis Sellier
parent f3c6d31d4c
commit afd983b9ea
2 changed files with 7 additions and 6 deletions

View File

@@ -146,11 +146,12 @@ function loadStyleSheet(sheet, callback, reload, remaining) {
}
function extractId(href) {
return href.replace(/^[a-z]+:\/\/?[^\/]+/, '') // Remove protocol & domain
.replace(/^\//, '') // Remove root /
.replace(/\?.*$/, '') // Remove query
.replace(/\.[^\/]+$/, '') // Remove file extension
.replace(/[^\w-]+/g, '-'); // Replace illegal characters
return href.replace(/^[a-z]+:\/\/?[^\/]+/, '' ) // Remove protocol & domain
.replace(/^\//, '' ) // Remove root /
.replace(/\?.*$/, '' ) // Remove query
.replace(/\.[^\.\/]+$/, '' ) // Remove file extension
.replace(/[^\.\w-]+/g, '-') // Replace illegal characters
.replace(/\./g, ':'); // Replace dots with colons(for valid id)
}
function createCSS(styles, sheet, lastModified) {

View File

@@ -522,7 +522,7 @@ less.Parser = function Parser(env) {
var value;
if (input.charAt(i) !== 'u' || !$(/^url\(/)) return;
value = $(this.entities.quoted) || $(this.entities.variable) || $(/^[-\w%@$\/.&=:;#+?]+/);
value = $(this.entities.quoted) || $(this.entities.variable) || $(/^[-\w%@$\/.&=:;#+?]+/) || "";
if (! $(')')) throw new(Error)("missing closing ) for url()");
return new(tree.URL)((value.value || value instanceof tree.Variable)