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
This commit is contained in:
Felix Gnass
2012-11-14 16:13:58 +01:00
committed by Luke Page
parent 37c3b099c3
commit 811eb1915c

View File

@@ -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) {