diff --git a/dist/less-1.0.20.min.js b/dist/less-1.0.20.min.js deleted file mode 100644 index d157592..0000000 --- a/dist/less-1.0.20.min.js +++ /dev/null @@ -1,60 +0,0 @@ -// -// LESS - Leaner CSS v1.0.20 -// http://lesscss.org -// -// Copyright (c) 2010, Alexis Sellier -// Licensed under the Apache 2.0 License. -// -(function(u){function q(b){return u.less[b.split("/")[1]]}function O(b){if(!document.querySelectorAll&&typeof jQuery==="undefined")y("no selector method found.");else return(document.querySelectorAll||jQuery).call(document,b)}function I(b,a){for(var d=0;d0)f.firstChild.nodeValue!==j.nodeValue&&f.replaceChild(j,f.firstChild);else f.appendChild(j)})(document.createTextNode(b));if(d&&x){y("saving "+a.href+" to cache.");x.setItem(a.href,b);x.setItem(a.href+":timestamp",d)}}function P(b,a,d){function f(j,k,p){if(j.status>=200&&j.status<300)k(j.responseText,j.getResponseHeader("Last-Modified"));else typeof p==="function"&&p(j.status)}var e=R(),i= -E?false:o.async;e.open("GET",b,i);e.send(null);if(E)e.status===0?a(e.responseText):d(e.status);else if(i)e.onreadystatechange=function(){e.readyState==4&&f(e,a,d)};else f(e,a,d)}function R(){if(u.XMLHttpRequest)return new XMLHttpRequest;else try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(b){y("browser doesn't support AJAX.");return null}}function Q(b){return b&&b.parentNode.removeChild(b)}function y(b){o.env=="development"&&typeof console!=="undefined"&&console.log("less: "+b)}function L(b, -a){var d="less-error-message:"+a.replace(/[^a-z]+/ig,"-");if(!b.extract)throw b;var f=document.createElement("div"),e;f.id=d;f.className="less-error-message";f.innerHTML="

"+(b.message||"There is an error in your .less file")+'

'+a+" on line "+b.line+", column "+(b.column+1)+":

"+'
\n
[-1]{0}
\n
[0]{current}
\n
[1]{2}
\n
'.replace(/\[(-?\d)\]/g,function(i,j){return parseInt(b.line)+ -parseInt(j)||""}).replace(/\{(\d)\}/g,function(i,j){return b.extract[parseInt(j)]||""}).replace(/\{current\}/,b.extract[1].slice(0,b.column)+''+b.extract[1].slice(b.column)+"");D(".less-error-message span {\nmargin-right: 15px;\n}\n.less-error-message pre {\ncolor: #ee4444;\npadding: 4px 0;\nmargin: 0;\n}\n.less-error-message pre.ctx {\ncolor: #dd7777;\n}\n.less-error-message h3 {\npadding: 15px 0 5px 0;\nmargin: 0;\n}\n.less-error-message a {\ncolor: #10a\n}\n.less-error-message .error {\ncolor: red;\nfont-weight: bold;\npadding-bottom: 2px;\nborder-bottom: 1px dashed red;\n}", -{title:"error-message"});f.style.cssText="font-family: Arial, sans-serif;border: 1px solid #e00;background-color: #eee;border-radius: 5px;-webkit-border-radius: 5px;-moz-border-radius: 5px;color: #e00;padding: 15px;margin-bottom: 15px";if(o.env=="development")e=setInterval(function(){if(document.body){document.getElementById(d)?document.body.replaceChild(f,document.getElementById(d)):document.body.insertBefore(f,document.body.firstChild);clearInterval(e)}},10)}if(!Array.isArray)Array.isArray=function(b){return Object.prototype.toString.call(b)=== -"[object Array]"||b instanceof Array};if(!Array.prototype.forEach)Array.prototype.forEach=function(b,a){for(var d=this.length>>>0,f=0;f>>0,f=new Array(d),e=0;e>>0,d=0;if(a===0&&arguments.length===1)throw new TypeError;if(arguments.length>=2)var f=arguments[1];else{do{if(d in this){f=this[d++];break}if(++d>=a)throw new TypeError;}while(1)}for(;d=d)return-1;if(a<0)a+=d;for(;a= -p+k[i].length&&i0){f=f.replace(/\/\*(?:[^*]|\*+[^\/*])*\*+\//g,function(F){return t.optimization>1?"":F.replace(/\n(\s*\n)+/g,"\n")});k=f.split(/^(?=\n)/mg)}else k= -[f];l=new m.Ruleset([],a(this.parsers.primary));l.root=true;l.toCSS=function(F){var A,B;return function(v){function G(S){return(f.slice(0,S).match(/\n/g)||"").length}v=v||{};try{var C=F.call(this,[],{frames:[],compress:v.compress||false});return v.compress?C.replace(/(\s)+/g,"$1"):C}catch(w){B=f.split("\n");A=G(w.index);v=w.index;for(C=-1;v>=0&&f.charAt(v)!=="\n";v--)C++;throw{name:"NameError",message:w.message,filename:b.filename,index:w.index,line:A+1,callLine:w.call&&G(w.call)+1,callExtract:B[G(w.call)- -1],stack:w.stack,column:C,extract:[B[A-1],B[A],B[A+1]]};}}}(l.toCSS);if(e=0&&f.charAt(H)!=="\n";H--)N++;z={name:"ParseError",message:"Syntax Error on line "+g,filename:b.filename,line:g,column:N,extract:[n[g-2],n[g-1],n[g]]}}if(this.imports.queue.length>0)s=function(){h(z,l)};else h(z,l)},parsers:{primary:function(){for(var g,h=[];g=a(this.mixin.definition)||a(this.rule)||a(this.ruleset)||a(this.mixin.call)|| -a(this.comment)||a(/[\n\s]+/g)||a(this.directive);)h.push(g);return h},comment:function(){var g;if(f.charAt(e)==="/")if(f.charAt(e+1)==="/")return new m.Comment(a(/\/\/.*/g),true);else if(g=a(/\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/g))return new m.Comment(g)},entities:{quoted:function(){var g;if(!(f.charAt(e)!=='"'&&f.charAt(e)!=="'"))if(g=a(/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/g))return new m.Quoted(g[0],g[1]||g[2])},keyword:function(){var g;if(g=a(/[A-Za-z-]+/g))return new m.Keyword(g)},call:function(){var g, -h;if(g=a(/([\w-]+|%)\(/g)){if(g[1].toLowerCase()==="alpha")return a(this.alpha);h=a(this.entities.arguments);if(a(")"))if(g)return new m.Call(g[1],h)}},arguments:function(){for(var g=[],h;h=a(this.expression);){g.push(h);if(!a(","))break}return g},literal:function(){return a(this.entities.dimension)||a(this.entities.color)||a(this.entities.quoted)},url:function(){var g;if(!(f.charAt(e)!=="u"||!a(/url\(/g))){g=a(this.entities.quoted)||a(/[-\w%@$\/.&=:;#+?]+/g);if(!a(")"))throw new Error("missing closing ) for url()"); -return new m.URL(g.value?g:new m.Anonymous(g))}},variable:function(){var g,h=e;if(f.charAt(e)==="@"&&(g=a(/@[\w-]+/g)))return new m.Variable(g,h)},color:function(){var g;if(f.charAt(e)==="#"&&(g=a(/#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/g)))return new m.Color(g[1])},dimension:function(){var g;g=f.charCodeAt(e);if(!(g>57||g<45||g===47))if(g=a(/(-?\d*\.?\d+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm)?/g))return new m.Dimension(g[1],g[2])}},variable:function(){var g;if(f.charAt(e)==="@"&&(g=a(/(@[\w-]+)\s*:/g)))return g[1]}, -shorthand:function(){var g,h;if(d(/[@\w.-]+\/[@\w.-]+/g))if((g=a(this.entity))&&a("/")&&(h=a(this.entity)))return new m.Shorthand(g,h)},mixin:{call:function(){for(var g=[],h,l,n,z=e;h=a(/[#.][\w-]+/g);){g.push(new m.Element(l,h));l=a(">")}a("(")&&(n=a(this.entities.arguments))&&a(")");if(g.length>0&&(a(";")||d("}")))return new m.mixin.Call(g,n,z)},definition:function(){var g,h=[],l,n;if(!(f.charAt(e)!=="."||d(/[^{]*(;|})/g)))if(g=a(/([#.][\w-]+)\s*\(/g)){for(g=g[1];l=a(/@[\w-]+/g)||a(this.entities.literal)|| -a(this.entities.keyword);){if(l[0]==="@")if(a(":"))if(n=a(this.expression))h.push({name:l,value:n});else throw new Error("Expected value");else h.push({name:l});else h.push({value:l});if(!a(","))break}if(!a(")"))throw new Error("Expected )");if(l=a(this.block))return new m.mixin.Definition(g,h,l)}}},entity:function(){return a(this.entities.literal)||a(this.entities.variable)||a(this.entities.url)||a(this.entities.call)||a(this.entities.keyword)},end:function(){return a(";")||d("}")},alpha:function(){var g; -if(a(/opacity=/gi))if(g=a(/\d+/g)||a(this.entities.variable)){if(!a(")"))throw new Error("missing closing ) for alpha()");return new m.Alpha(g)}},element:function(){var g;c=a(this.combinator);if(g=a(/[.#:]?[\w-]+/g)||a("*")||a(this.attribute)||a(/\([^)@]+\)/g))return new m.Element(c,g)},combinator:function(){var g;return(g=a(/[+>~]/g)||a("&")||a(/::/g))?new m.Combinator(g):new m.Combinator(f.charAt(e-1)===" "?" ":null)},selector:function(){for(var g,h=[];g=a(this.element);)h.push(g);if(h.length>0)return new m.Selector(h)}, -tag:function(){return a(/[a-zA-Z][a-zA-Z-]*[0-9]?/g)||a("*")},attribute:function(){var g="",h,l,n;if(a("[")){if(h=a(/[a-z-]+/g)||a(this.entities.quoted))g=(n=a(/[|~*$^]?=/g))&&(l=a(this.entities.quoted)||a(/[\w-]+/g))?[h,n,l.toCSS?l.toCSS():l].join(""):h;if(a("]"))if(g)return"["+g+"]"}},block:function(){var g;if(a("{")&&(g=a(this.primary))&&a("}"))return g},ruleset:function(){var g=[],h,l,n=e;if(h=d(/([.#: \w-]+)[\s\n]*\{/g)){e+=h[0].length-1;g=[new m.Selector([new m.Element(null,h[1])])]}else{for(;h= -a(this.selector);){g.push(h);if(!a(","))break}h&&a(this.comment)}if(g.length>0&&(l=a(this.block)))return new m.Ruleset(g,l);else{j=e;e=n}},rule:function(){var g,h=e;if(name=a(this.property)||a(this.variable)){if(name.charAt(0)!="@"&&(match=d(/([^@+\/*(;{}-]*);/g))){e+=match[0].length-1;g=new m.Anonymous(match[1])}else g=name==="font"?a(this.font):a(this.value);if(a(this.end))return new m.Rule(name,g,h);else{j=e;e=h}}},"import":function(){var g;if(a(/@import\s+/g)&&(g=a(this.entities.quoted)||a(this.entities.url))&& -a(";"))return new m.Import(g,M)},directive:function(){var g,h,l;if(f.charAt(e)==="@")if(h=a(this["import"]))return h;else if(g=a(/@media|@page/g)){l=a(/[^{]+/g).trim();if(h=a(this.block))return new m.Directive(g+" "+l,h)}else if(g=a(/@[-a-z]+/g))if(g==="@font-face"){if(h=a(this.block))return new m.Directive(g,h)}else if((h=a(this.entity))&&a(";"))return new m.Directive(g,h)},font:function(){for(var g=[],h=[],l;l=a(this.shorthand)||a(this.entity);)h.push(l);g.push(new m.Expression(h));if(a(","))for(;l= -a(this.expression);){g.push(l);if(!a(","))break}return new m.Value(g,a(this.important))},value:function(){for(var g,h=[];g=a(this.expression);){h.push(g);if(!a(","))break}g=a(this.important);if(h.length>0)return new m.Value(h,g)},important:function(){return a(/!\s*important/g)},sub:function(){var g;if(a("(")&&(g=a(this.expression))&&a(")"))return g},multiplication:function(){var g,h,l,n;if(g=a(this.operand)){for(;(l=a(/[\/*]/g))&&(h=a(this.operand));)n=new m.Operation(l,[n||g,h]);return n||g}},addition:function(){var g, -h,l,n;if(g=a(this.multiplication)){for(;(l=a(/[-+]\s+/g)||f.charAt(e-1)!=" "&&a(/[-+]/g))&&(h=a(this.multiplication));)n=new m.Operation(l,[n||g,h]);return n||g}},operand:function(){return a(this.sub)||a(this.entities.dimension)||a(this.entities.color)||a(this.entities.variable)},expression:function(){for(var g,h=[];g=a(this.addition)||a(this.entity);)h.push(g);if(h.length>0)return new m.Expression(h)},property:function(){var g;if(g=a(/(\*?-?[-a-z_0-9]+)\s*:/g))return g[1]}}}};if(typeof u!=="undefined")o.Parser.importer= -function(b,a,d){K({href:b,title:b},function(f){d(f)})};(function(b){function a(e){return b.functions.hsla(e.h,e.s,e.l,e.a)}function d(e){if(e instanceof b.Dimension)return parseFloat(e.unit=="%"?e.value/100:e.value);else if(typeof e==="number")return e;else throw{error:"RuntimeError",message:"color functions take numbers as parameters"};}function f(e){return Math.min(1,Math.max(0,e))}b.functions={rgb:function(e,i,j){return this.rgba(e,i,j,1)},rgba:function(e,i,j,k){e=[e,i,j].map(function(p){return d(p)}); -k=d(k);return new b.Color(e,k)},hsl:function(e,i,j){return this.hsla(e,i,j,1)},hsla:function(e,i,j,k){function p(s){s=s<0?s+1:s>1?s-1:s;return s*6<1?t+(r-t)*s*6:s*2<1?r:s*3<2?t+(r-t)*(2/3-s)*6:t}e=d(e)%360/360;i=d(i);j=d(j);k=d(k);var r=j<=0.5?j*(i+1):j+i-j*i,t=j*2-r;return this.rgba(p(e+1/3)*255,p(e)*255,p(e-1/3)*255,k)},hue:function(e){return new b.Dimension(Math.round(e.toHSL().h))},saturation:function(e){return new b.Dimension(Math.round(e.toHSL().s*100),"%")},lightness:function(e){return new b.Dimension(Math.round(e.toHSL().l* -100),"%")},alpha:function(e){return new b.Dimension(e.toHSL().a)},saturate:function(e,i){e=e.toHSL();e.s+=i.value/100;e.s=f(e.s);return a(e)},desaturate:function(e,i){e=e.toHSL();e.s-=i.value/100;e.s=f(e.s);return a(e)},lighten:function(e,i){e=e.toHSL();e.l+=i.value/100;e.l=f(e.l);return a(e)},darken:function(e,i){e=e.toHSL();e.l-=i.value/100;e.l=f(e.l);return a(e)},spin:function(e,i){e=e.toHSL();i=(e.h+i.value)%360;e.h=i<0?360+i:i;return a(e)},greyscale:function(e){return this.desaturate(e,new b.Dimension(100))}, -e:function(e){return new b.Anonymous(e)},"%":function(e){for(var i=Array.prototype.slice.call(arguments,1),j=e.content,k=0;k255?255:a<0?0:a).toString(16);return a.length===1?"0"+a:a}).join("")},operate:function(a, -d){var f=[];d instanceof b.Color||(d=d.toColor());for(var e=0;e<3;e++)f[e]=b.operate(a,this.rgb[e],d.rgb[e]);return new b.Color(f)},toHSL:function(){var a=this.rgb[0]/255,d=this.rgb[1]/255,f=this.rgb[2]/255,e=this.alpha,i=Math.max(a,d,f),j=Math.min(a,d,f),k,p=(i+j)/2,r=i-j;if(i===j)k=j=0;else{j=p>0.5?r/(2-i-j):r/(i+j);switch(i){case a:k=(d-f)/r+(d":a.compress?">":" > "}[this.value]}})(q("less/tree"));(function(b){b.Expression=function(a){this.value=a};b.Expression.prototype={eval:function(a){return this.value.length>1?new b.Expression(this.value.map(function(d){return d.eval(a)})):this.value[0].eval(a)},toCSS:function(){return this.value.map(function(a){return a.toCSS()}).join(" ")}}})(q("less/tree"));(function(b){b.Import=function(a,d){var f=this;this._path= -a;this.path=a instanceof b.Quoted?/\.(le?|c)ss$/.test(a.content)?a.content:a.content+".less":a.value.content||a.value;(this.css=/css$/.test(this.path))||d.push(this.path,function(e){if(!e)throw new Error("Error parsing "+f.path);f.root=e})};b.Import.prototype={toCSS:function(){return this.css?"@import "+this._path.toCSS()+";\n":""},eval:function(){if(this.css)return this;else{for(var a=0;a0){for(i=0;i< -d.length;i++)if(d[i].match(this.arguments,a))try{Array.prototype.push.apply(f,d[i].eval(this.arguments,a).rules);e=true}catch(j){throw{message:j.message,index:j.index,call:this.index};}if(e)return f;else throw{message:"No matching definition was found for `"+this.selector.toCSS().trim()+"("+this.arguments.map(function(k){return k.toCSS()}).join(", ")+")`",index:this.index};}throw{message:this.selector.toCSS().trim()+" is undefined",index:this.index};}};b.mixin.Definition=function(a,d,f){this.name= -a;this.selectors=[new b.Selector([new b.Element(null,a)])];this.params=d;this.arity=d.length;this.rules=f;this._lookups={};this.required=d.reduce(function(e,i){return i.name&&!i.value?e+1:e},0);this.parent=b.Ruleset.prototype};b.mixin.Definition.prototype={toCSS:function(){return""},variable:function(a){return this.parent.variable.call(this,a)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},eval:function(a,d){for(var f=new b.Ruleset(null, -[]),e=0,i;e1?Array.prototype.push.apply(f,i.find(new b.Selector(a.elements.slice(1)),d)):f.push(i);break}});return this._lookups[e]=f},toCSS:function(a,d){var f=[],e=[],i=[],j=[];if(this.root)for(var k=0;k0){j=j.map(function(r){return r.map(function(t){return t.toCSS(d)}).join("").trim()}).join(d.compress?",":j.length>3?",\n":", ");f.push(j,(d.compress?"{":" {\n ")+e.join(d.compress?"":"\n ")+(d.compress?"}":"\n}\n"))}f.push(i); -d.frames.shift();return f.join("")+(d.compress?"\n":"")}}})(q("less/tree"));(function(b){b.Selector=function(a){this.elements=a;if(this.elements[0].combinator.value==="")this.elements[0].combinator.value=" "};b.Selector.prototype.match=function(a){return this.elements[0].value===a.elements[0].value?true:false};b.Selector.prototype.toCSS=function(a){if(this._css)return this._css;return this._css=this.elements.map(function(d){return typeof d==="string"?" "+d.trim():d.toCSS(a)}).join("")}})(q("less/tree")); -(function(b){b.URL=function(a){this.value=a};b.URL.prototype={toCSS:function(){return"url("+this.value.toCSS()+")"},eval:function(){return this}}})(q("less/tree"));(function(b){b.Value=function(a){this.value=a;this.is="value"};b.Value.prototype={eval:function(a){return this.value.length===1?this.value[0].eval(a):new b.Value(this.value.map(function(d){return d.eval(a)}))},toCSS:function(a){return this.value.map(function(d){return d.toCSS(a)}).join(a.compress?",":", ")}}})(q("less/tree"));(function(b){b.Variable= -function(a,d){this.name=a;this.index=d};b.Variable.prototype={eval:function(a){var d,f,e=this.name;if(d=b.find(a.frames,function(i){if(f=i.variable(e))return f.value.eval(a)}))return d;else throw{message:"variable "+this.name+" is undefined",index:this.index};}}})(q("less/tree"));q("less/tree").find=function(b,a){for(var d=0,f;d0||E?"development":"production";o.async=false;o.poll=E?1E3:1500;o.watch=function(){return this.watchMode=true};o.unwatch=function(){return this.watchMode=false};if(o.env==="development"){o.optimization=0;/!watch/.test(location.hash)&&o.watch();o.watchTimer=setInterval(function(){o.watchMode&&I(function(b,a,d){b&&D(b.toCSS(),a,d.lastModified)})},o.poll)}else o.optimization=3;var x=typeof u.localStorage==="undefined"?null:u.localStorage,J=O('link[rel="stylesheet/less"]'); -o.refresh=function(b){I(function(a,d,f){if(f.local)y("loading "+d.href+" from cache.");else{y("parsed "+d.href+" successfully.");D(a.toCSS(),d,f.lastModified)}},b)};o.refresh()})(window); diff --git a/dist/less-1.0.20.js b/dist/less-1.0.21.js similarity index 98% rename from dist/less-1.0.20.js rename to dist/less-1.0.21.js index 4a44d15..3bde5ca 100644 --- a/dist/less-1.0.20.js +++ b/dist/less-1.0.21.js @@ -1,5 +1,5 @@ // -// LESS - Leaner CSS v1.0.20 +// LESS - Leaner CSS v1.0.21 // http://lesscss.org // // Copyright (c) 2010, Alexis Sellier @@ -1067,6 +1067,9 @@ if (typeof(window) !== 'undefined') { // Used by `@import` directives // less.Parser.importer = function (path, paths, callback) { + if (path[0] !== '/' && paths.length > 0) { + path = paths[0] + path; + } loadStyleSheet({ href: path, title: path }, function (root) { callback(root); }); @@ -2065,6 +2068,8 @@ var cache = (typeof(window.localStorage) === 'undefined') ? null : window.localS // var sheets = select('link[rel="stylesheet/less"]'); +var startTime = endTime = new(Date); + less.refresh = function (reload) { loadStyleSheets(function (root, sheet, env) { if (env.local) { @@ -2073,6 +2078,9 @@ less.refresh = function (reload) { log("parsed " + sheet.href + " successfully."); createCSS(root.toCSS(), sheet, env.lastModified); } + log("css for " + sheet.href + " generated in " + (new(Date) - endTime) + 'ms'); + (env.remaining === 0) && log("css generated in " + (new(Date) - startTime) + 'ms'); + endTime = new(Date); }, reload); }; @@ -2088,13 +2096,14 @@ function select(str) { function loadStyleSheets(callback, reload) { for (var i = 0; i < sheets.length; i++) { - loadStyleSheet(sheets[i], callback, reload); + loadStyleSheet(sheets[i], callback, reload, sheets.length - (i + 1)); } } -function loadStyleSheet(sheet, callback, reload) { - var css = cache && cache.getItem(sheet.href); - var timestamp = cache && cache.getItem(sheet.href + ':timestamp'); +function loadStyleSheet(sheet, callback, reload, remaining) { + var href = sheet.href.replace(/\?.*$/, ''); + var css = cache && cache.getItem(href); + var timestamp = cache && cache.getItem(href + ':timestamp'); var styles = { css: css, timestamp: timestamp }; xhr(sheet.href, function (data, lastModified) { @@ -2103,31 +2112,35 @@ function loadStyleSheet(sheet, callback, reload) { new(Date)(styles.timestamp).valueOf())) { // Use local copy createCSS(styles.css, sheet); - callback(null, sheet, { local: true }); + callback(null, sheet, { local: true, remaining: remaining }); } else { // Use remote copy (re-parse) new(less.Parser)({ - optimization: less.optimization + optimization: less.optimization, + paths: [href.replace(/[\w\.-]+$/, '')] }).parse(data, function (e, root) { - if (e) { return error(e, sheet.href) } + if (e) { return error(e, href) } try { - callback(root, sheet, { local: false, lastModified: lastModified }); - removeNode(document.getElementById('less-error-message:' + sheet.href.replace(/[^a-z]+/gi, '-'))); + callback(root, sheet, { local: false, lastModified: lastModified, remaining: remaining }); + removeNode(document.getElementById('less-error-message:' + href.replace(/[^a-z]+/gi, '-'))); } catch (e) { - error(e, sheet.href); + error(e, href); } }); } - }, function (status) { - throw new(Error)("Couldn't load " + sheet.href + " (" + status + ")"); + }, function (status, url) { + throw new(Error)("Couldn't load " + url+ " (" + status + ")"); }); } function createCSS(styles, sheet, lastModified) { var css; + // Strip the query-string + var href = sheet.href.replace(/\?.*$/, ''); + // If there is no title set, use the filename, minus the extension - var id = 'less:' + (sheet.title || sheet.href.match(/(?:^|\/)([-\w]+)\.[a-z]+$/i)[1]); + var id = 'less:' + (sheet.title || href.match(/(?:^|\/)([-\w]+)\.[a-z]+$/i)[1]); // If the stylesheet doesn't exist, create a new node if ((css = document.getElementById(id)) === null) { @@ -2158,9 +2171,9 @@ function createCSS(styles, sheet, lastModified) { // Don't update the local store if the file wasn't modified if (lastModified && cache) { - log('saving ' + sheet.href + ' to cache.'); - cache.setItem(sheet.href, styles); - cache.setItem(sheet.href + ':timestamp', lastModified); + log('saving ' + href + ' to cache.'); + cache.setItem(href, styles); + cache.setItem(href + ':timestamp', lastModified); } } @@ -2192,7 +2205,7 @@ function xhr(url, callback, errback) { callback(xhr.responseText, xhr.getResponseHeader("Last-Modified")); } else if (typeof(errback) === 'function') { - errback(xhr.status); + errback(xhr.status, url); } } }