Skip to content

Commit 666e386

Browse files
author
vasia
committed
test
1 parent 2563b97 commit 666e386

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/compilers/postcss-compiler.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
const postcss = require('postcss');
22
const postcssrc = require('postcss-load-config')
3+
const throwError = require('../throw-error')
34

45
const ctx = { parser: true, map: 'inline' }
56

67
const { plugins, options } = postcssrc.sync(ctx)
78

9+
console.log(options, 7777);
10+
811
module.exports = (content) => {
9-
console.log(888, plugins)
1012
let css = null
1113

1214
postcss(plugins)
13-
.process(content, options)
15+
.process(content, options || {})
1416
.then(result => {
1517
css = result.css || ''
1618
})
19+
.catch((e) => {
20+
css = ''
21+
throwError(e)
22+
})
1723

1824
while (css === null) { //eslint-disable-line
1925
require('deasync').sleep(100)

lib/process-style.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ module.exports = function processStyle (stylePart, filePath, jestConfig = {}) {
2222
case 'sass':
2323
cssCode = processStyleByLang('sass')
2424
break
25+
case 'pcss':
26+
case 'postcss':
27+
cssCode = processStyleByLang('postcss')
28+
break
2529
}
2630

2731
const cssNames = cssExtract.extractClasses(cssCode)

0 commit comments

Comments
 (0)