You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to ask you, what happens to the text value of line comments after parsing? When I get the AST, their value is an empty string. Block comment values are returned correctly. Here I see, that the parser saves the comment's text value regardless its type.
Should I pass some extra option to the parser, or is it a bug?
Thanks in advance :)
This is my code for parsing:
var less = require('/usr/local/lib/node_modules/less/lib/less-node')
, fs = require('fs')
, path = require('path');
module.exports = {
parse: function(src, isStdin) {
// Parses a Less file and outputs its AST
var visit = function(o) {
// Attaches the node type to the necessary objects
for (var p in o) {
if (typeof o[p] == 'object') visit(o[p]);
}
if (o != null && o != "") {
if ("type" in o) o["class"] = o.type;
}
};
var code = src;
var options = {};
if (!isStdin) {
code = fs.readFileSync(src, 'utf8').toString();
options = {
filename: path.resolve(src)
}
}
return less.parse(code, options, function(e, tree) {
if (!e) {
visit(tree);
console.log(JSON.stringify(tree, null, 2));
} else {
e.class = "error"
console.log(JSON.stringify(e));
}
});
}
};
Hi Guys!
I'd like to ask you, what happens to the text value of line comments after parsing? When I get the AST, their value is an empty string. Block comment values are returned correctly.
Here I see, that the parser saves the comment's text value regardless its type.
Should I pass some extra option to the parser, or is it a bug?
Thanks in advance :)
This is my code for parsing:
And an extract from its output:
The text was updated successfully, but these errors were encountered: