debug-info.js (less.js-4.1.2) | : | debug-info.js (less.js-4.1.3) | ||
---|---|---|---|---|
class debugInfo { | function asComment(ctx) { | |||
constructor(context, ctx, lineSeparator) { | return `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n` | |||
let result = ''; | ; | |||
if (context.dumpLineNumbers && !context.compress) { | } | |||
switch (context.dumpLineNumbers) { | ||||
case 'comments': | ||||
result = debugInfo.asComment(ctx); | ||||
break; | ||||
case 'mediaquery': | ||||
result = debugInfo.asMediaQuery(ctx); | ||||
break; | ||||
case 'all': | ||||
result = debugInfo.asComment(ctx) + (lineSeparator || '') + | ||||
debugInfo.asMediaQuery(ctx); | ||||
break; | ||||
} | ||||
} | ||||
return result; | ||||
} | ||||
static asComment(ctx) { | function asMediaQuery(ctx) { | |||
return `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} * | let filenameWithProtocol = ctx.debugInfo.fileName; | |||
/\n`; | if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { | |||
filenameWithProtocol = `file://${filenameWithProtocol}`; | ||||
} | } | |||
return `@media -sass-debug-info{filename{font-family:${filenameWithProtocol. | ||||
replace(/([.:\/\\])/g, function (a) { | ||||
if (a == '\\') { | ||||
a = '\/'; | ||||
} | ||||
return `\\${a}`; | ||||
})}}line{font-family:\\00003${ctx.debugInfo.lineNumber}}}\n`; | ||||
} | ||||
static asMediaQuery(ctx) { | function debugInfo(context, ctx, lineSeparator) { | |||
let filenameWithProtocol = ctx.debugInfo.fileName; | let result = ''; | |||
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { | if (context.dumpLineNumbers && !context.compress) { | |||
filenameWithProtocol = `file://${filenameWithProtocol}`; | switch (context.dumpLineNumbers) { | |||
case 'comments': | ||||
result = asComment(ctx); | ||||
break; | ||||
case 'mediaquery': | ||||
result = asMediaQuery(ctx); | ||||
break; | ||||
case 'all': | ||||
result = asComment(ctx) + (lineSeparator || '') + asMediaQuery(c | ||||
tx); | ||||
break; | ||||
} | } | |||
return `@media -sass-debug-info{filename{font-family:${filenameWithProto | ||||
col.replace(/([.:\/\\])/g, function (a) { | ||||
if (a == '\\') { | ||||
a = '\/'; | ||||
} | ||||
return `\\${a}`; | ||||
})}}line{font-family:\\00003${ctx.debugInfo.lineNumber}}}\n`; | ||||
} | } | |||
return result; | ||||
} | } | |||
export default debugInfo; | export default debugInfo; | |||
End of changes. 6 change blocks. | ||||
33 lines changed or deleted | 31 lines changed or added |