From 811eb1915cf2aeb607f2fd1248e100f1acfb1cad Mon Sep 17 00:00:00 2001 From: Felix Gnass Date: Wed, 14 Nov 2012 16:13:58 +0100 Subject: [PATCH] Make sass-debug-info compatible with DevTools In order to make the debug info compatible with Chrome's built-in experimental Sass support: 1) The filename must be a file:// URL 2) The path must be escaped rather than quoted --- lib/less/tree.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/less/tree.js b/lib/less/tree.js index 7038ecc4..134adbdf 100644 --- a/lib/less/tree.js +++ b/lib/less/tree.js @@ -23,7 +23,9 @@ tree.debugInfo.asComment = function(ctx) { }; tree.debugInfo.asMediaQuery = function(ctx) { - return '@media -sass-debug-info{filename{font-family:"' + ctx.debugInfo.fileName + '";}line{font-family:"' + ctx.debugInfo.lineNumber + '";}}\n'; + return '@media -sass-debug-info{filename{font-family:' + + ('file://' + ctx.debugInfo.fileName).replace(/[\/:.]/g, '\\$&') + + '}line{font-family:\\00003' + ctx.debugInfo.lineNumber + '}}\n'; }; tree.find = function (obj, fun) {