Skip to content

Commit

Permalink
Fix #467
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Jan 17, 2024
1 parent 4c5a69c commit 7f1725b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ buildCliConfig()
process.exit(1)
})

function rc(ctx, path) {
function rc(ctx, path, cliConfigPath) {
if (argv.use) return Promise.resolve(cliConfig)

return postcssrc(ctx, path)
Expand All @@ -178,7 +178,7 @@ function rc(ctx, path) {
return rc
})
.catch((err) => {
if (!err.message.includes('No PostCSS Config found')) throw err
if (!err.message.includes('No PostCSS Config found') || cliConfigPath) throw err
})
}

Expand All @@ -202,6 +202,8 @@ function files(files) {
function css(css, file) {
const ctx = { options: cliConfig.options }

const origArgvConfig = argv.config

if (file !== 'stdin') {
ctx.file = {
dirname: path.dirname(file),
Expand All @@ -221,7 +223,7 @@ function css(css, file) {

printVerbose(pc.cyan(`Processing ${pc.bold(relativePath)}...`))

return rc(ctx, argv.config)
return rc(ctx, argv.config, origArgvConfig)
.then((config) => {
config = config || cliConfig
const options = { ...config.options }
Expand Down

0 comments on commit 7f1725b

Please sign in to comment.