Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ const LessParser = require('./LessParser');
const LessStringifier = require('./LessStringifier');

module.exports = {
nodeToString(node) {
let result = '';

module.exports.stringify(node, (bit) => {
result += bit;
});

return result;
},

parse(less, options) {
const input = new Input(less, options);
const parser = new LessParser(input);
Expand Down Expand Up @@ -40,9 +50,9 @@ module.exports = {

// eslint-disable-next-line no-param-reassign
node.source.start = {
offset: newStartOffset,
column: newStartPosition.col,
line: newStartPosition.line,
column: newStartPosition.col
offset: newStartOffset
};

// Not all nodes have an `end` property.
Expand All @@ -52,9 +62,9 @@ module.exports = {

// eslint-disable-next-line no-param-reassign
node.source.end = {
offset: newEndOffset,
column: newEndPosition.col,
line: newEndPosition.line,
column: newEndPosition.col
offset: newEndOffset
};
}
});
Expand All @@ -65,15 +75,5 @@ module.exports = {
stringify(node, builder) {
const stringifier = new LessStringifier(builder);
stringifier.stringify(node);
},

nodeToString(node) {
let result = '';

module.exports.stringify(node, (bit) => {
result += bit;
});

return result;
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@commitlint/config-conventional": "12.1.4",
"ava": "3.15.0",
"cheerio": "1.0.0-rc.10",
"eslint-config-shellscape": "2.0.2",
"eslint-config-shellscape": "6.0.2",
"eslint-plugin-filenames": "1.2.0",
"is-absolute-url": "3.0.0",
"less": "4.1.1",
Expand Down
4 changes: 2 additions & 2 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ for (const site of sites) {
const css = await req.text();

await postcss().process(css, {
parser: syntax.parse,
from: null,
map: { annotation: false },
from: null
parser: syntax.parse
});
}

Expand Down
8 changes: 4 additions & 4 deletions test/map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ console.warn = () => {}; // eslint-disable-line no-console
test('should parse LESS integration syntax and generate a source map', async (t) => {
const less = readFileSync(join(__dirname, './integration/ext.cx.dashboard.less'), 'utf-8');
const result = await postcss().process(less, {
syntax,
map: { annotation: false, inline: false, sourcesContent: true },
parser,
map: { inline: false, annotation: false, sourcesContent: true }
syntax
});

t.truthy(result);
Expand All @@ -34,9 +34,9 @@ test('should parse LESS inline comment syntax and generate a source map', async
}
`;
const result = await postcss().process(less, {
syntax,
map: { annotation: false, inline: false, sourcesContent: true },
parser,
map: { inline: false, annotation: false, sourcesContent: true }
syntax
});

t.truthy(result);
Expand Down
2 changes: 1 addition & 1 deletion test/postcss.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ console.warn = () => {}; // eslint-disable-line no-console

test('should process LESS syntax', async (t) => {
const less = 'a { b {} }';
const result = await postcss().process(less, { syntax, parser });
const result = await postcss().process(less, { parser, syntax });

t.truthy(result);
t.is(result.css, less);
Expand Down
Loading
Loading