Write to stdout in watch mode if no output file provided
This commit is contained in:
parent
bd20d2c0fa
commit
67ee5e033d
1 changed files with 7 additions and 1 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue