Skip to content

Commit b5a0c4f

Browse files
committed
Ignore PostCSS config not found error from postcss-load-config
1 parent d3f5edf commit b5a0c4f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ const globber = require('globby')
88
const watcher = require('chokidar')
99

1010
const postcss = require('postcss')
11-
const postcssrc = require('postcss-load-config')
11+
const postcssLoadConfig = require('postcss-load-config')
12+
13+
const postcssrc = () => {
14+
return postcssLoadConfig()
15+
.catch(e => {
16+
// Ignore PostCSS config not found error:
17+
if (e.message.indexOf('No PostCSS Config found') === -1) throw e
18+
else return {plugins: [], options: {}}
19+
})
20+
}
1221

1322
const logo = `
1423
/|\\

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"globby": "^6.0.0",
3333
"ora": "^0.4.0",
3434
"postcss": "^5.2.4",
35-
"postcss-load-config": "^1.0.0-rc",
35+
"postcss-load-config": "^1.1.0",
3636
"yargs": "^6.0.0"
3737
},
3838
"devDependencies": {

0 commit comments

Comments
 (0)