| 6307 | } |
| 6308 | |
| 6309 | function errorConsole(e, rootHref) { |
| 6310 | var template = '{line} {content}'; |
| 6311 | var filename = e.filename || rootHref; |
| 6312 | var errors = []; |
| 6313 | var content = (e.type || "Syntax") + "Error: " + (e.message || 'There is an error in your .less file') + |
| 6314 | " in " + filename + " "; |
| 6315 | |
| 6316 | var errorline = function (e, i, classname) { |
| 6317 | if (e.extract[i] !== undefined) { |
| 6318 | errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) |
| 6319 | .replace(/\{class\}/, classname) |
| 6320 | .replace(/\{content\}/, e.extract[i])); |
| 6321 | } |
| 6322 | }; |
| 6323 | |
| 6324 | if (e.extract) { |
| 6325 | errorline(e, 0, ''); |
| 6326 | errorline(e, 1, 'line'); |
| 6327 | errorline(e, 2, ''); |
| 6328 | content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':\n' + |
| 6329 | errors.join('\n'); |
| 6330 | } else if (e.stack) { |
| 6331 | content += e.stack; |
| 6332 | } |
| 6333 | log(content, logLevel.errors); |
| 6334 | } |
| 6335 | |
| 6336 | function createCSS(styles, sheet, lastModified) { |
| 6337 | // Strip the query-string |