mirror of
https://github.com/less/less.js.git
synced 2026-01-24 14:48:00 -05:00
29 lines
940 B
JavaScript
29 lines
940 B
JavaScript
module.exports = function (tree) {
|
|
|
|
var Comment = function (value, silent, index, currentFileInfo) {
|
|
this.value = value;
|
|
this.silent = !!silent;
|
|
this.currentFileInfo = currentFileInfo;
|
|
};
|
|
Comment.prototype = {
|
|
type: "Comment",
|
|
genCSS: function (env, output) {
|
|
if (this.debugInfo) {
|
|
output.add(tree.debugInfo(env, this), this.currentFileInfo, this.index);
|
|
}
|
|
output.add(this.value.trim()); //TODO shouldn't need to trim, we shouldn't grab the \n
|
|
},
|
|
toCSS: tree.toCSS,
|
|
isSilent: function(env) {
|
|
var isReference = (this.currentFileInfo && this.currentFileInfo.reference && !this.isReferenced),
|
|
isCompressed = env.compress && !this.value.match(/^\/\*!/);
|
|
return this.silent || isReference || isCompressed;
|
|
},
|
|
eval: function () { return this; },
|
|
markReferenced: function () {
|
|
this.isReferenced = true;
|
|
}
|
|
};
|
|
return Comment;
|
|
};
|