-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: source map (following #150) * lint map.test.js Co-authored-by: essentia0 <contact@essentia0.me>
- Loading branch information
essentia0
and
essentia0
authored
Jul 12, 2021
1 parent
20d1e57
commit b6fd291
Showing
4 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const { readFileSync } = require('fs'); | ||
|
||
const { join } = require('path'); | ||
|
||
const test = require('ava'); | ||
const postcss = require('postcss'); | ||
|
||
const syntax = require('../lib'); | ||
|
||
const { parser } = syntax; | ||
|
||
// silence the rediculously verbose "You did not set any plugins, parser, or | ||
// stringifier" warnings in PostCSS. | ||
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, | ||
parser, | ||
map: { inline: false, annotation: false, sourcesContent: true } | ||
}); | ||
|
||
t.truthy(result); | ||
t.is(result.css, less); | ||
t.is(result.content, less); | ||
t.truthy(result.map); | ||
}); | ||
|
||
test('should parse LESS inline comment syntax and generate a source map', async (t) => { | ||
const less = ` | ||
a { | ||
//background-color: red; | ||
} | ||
`; | ||
const result = await postcss().process(less, { | ||
syntax, | ||
parser, | ||
map: { inline: false, annotation: false, sourcesContent: true } | ||
}); | ||
|
||
t.truthy(result); | ||
t.is(result.css, less); | ||
t.is(result.content, less); | ||
t.truthy(result.map); | ||
}); |