mirror of
https://github.com/less/less.js.git
synced 2026-01-22 21:58:14 -05:00
Fixed dot in css name error(when using style.1.css and style.2.css), also fixed 'url()' error
This commit is contained in:
committed by
Alexis Sellier
parent
f3c6d31d4c
commit
afd983b9ea
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user