Permalink
Browse files

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
  • Loading branch information...
1 parent dddda0b commit 02374d56911b5ebf0862b29b7e2ef148161e27df @fgnass committed Nov 14, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/less/tree.js
View
@@ -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) {

0 comments on commit 02374d5

Please sign in to comment.