diff --git a/src/cli.js b/src/cli.js index 0b64fdd11e5d..a7dc333ae14a 100644 --- a/src/cli.js +++ b/src/cli.js @@ -546,7 +546,9 @@ async function build() { function processCSS(css) { let start = process.hrtime.bigint() return Promise.resolve() - .then(() => fs.promises.mkdir(path.dirname(output), { recursive: true })) + .then(() => + output ? fs.promises.mkdir(path.dirname(output), { recursive: true }) : null + ) .then(() => processor.process(css, { from: input, to: output })) .then(async (result) => { for (let message of result.messages) { @@ -556,6 +558,10 @@ async function build() { } watcher.add([...contextDependencies]) + if (!output) { + return process.stdout.write(result.css) + } + await Promise.all( [ fs.promises.writeFile(output, result.css, () => true),