Files
react-native-devtools-frontend/node_modules/postcss-less/lib/LessStringifier.js
T
Mathias Bynens 79e2cf0633 Add stylelint dependency
This also adds CC-BY-4.0 to the list of accepted licenses.

DISABLE_THIRD_PARTY_CHECK=update dependencies

Bug: chromium:1083142
Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-06-11 06:20:04 +00:00

43 lines
1.2 KiB
JavaScript

const Stringifier = require('postcss/lib/stringifier');
module.exports = class LessStringifier extends Stringifier {
atrule(node, semicolon) {
if (!node.mixin && !node.variable && !node.function) {
super.atrule(node, semicolon);
return;
}
const identifier = node.function ? '' : node.raws.identifier || '@';
let name = `${identifier}${node.name}`;
let params = node.params ? this.rawValue(node, 'params') : '';
const important = node.raws.important || '';
if (node.variable) {
params = node.value;
}
if (typeof node.raws.afterName !== 'undefined') {
name += node.raws.afterName;
} else if (params) {
name += ' ';
}
if (node.nodes) {
this.block(node, name + params + important);
} else {
const end = (node.raws.between || '') + important + (semicolon ? ';' : '');
this.builder(name + params + end, node);
}
}
comment(node) {
if (node.inline) {
const left = this.raw(node, 'left', 'commentLeft');
const right = this.raw(node, 'right', 'commentRight');
this.builder(`//${left}${node.text}${right}`, node);
} else {
super.comment(node);
}
}
};