You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
(function (tree) { |
|
|
|
tree.debugInfo = function(env, ctx) { |
|
var result=""; |
|
if (env.dumpLineNumbers && !env.compress) { |
|
switch(env.dumpLineNumbers) { |
|
case 'comments': |
|
result = tree.debugInfo.asComment(ctx); |
|
break; |
|
case 'mediaquery': |
|
result = tree.debugInfo.asMediaQuery(ctx); |
|
break; |
|
case 'all': |
|
result = tree.debugInfo.asComment(ctx)+tree.debugInfo.asMediaQuery(ctx); |
|
break; |
|
} |
|
} |
|
return result; |
|
}; |
|
|
|
tree.debugInfo.asComment = function(ctx) { |
|
return '/* line ' + ctx.debugInfo.lineNumber + ', ' + ctx.debugInfo.fileName + ' */\n'; |
|
}; |
|
|
|
tree.debugInfo.asMediaQuery = function(ctx) { |
|
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) { |
|
for (var i = 0, r; i < obj.length; i++) { |
|
if (r = fun.call(obj, obj[i])) { return r } |
|
} |
|
return null; |
|
}; |
|
tree.jsify = function (obj) { |
|
if (Array.isArray(obj.value) && (obj.value.length > 1)) { |
|
return '[' + obj.value.map(function (v) { return v.toCSS(false) }).join(', ') + ']'; |
|
} else { |
|
return obj.toCSS(false); |
|
} |
|
}; |
|
|
|
})(require('./tree'));
|
|
|