@@ -204,43 +204,45 @@ function css(css, file) {
204204 )
205205 }
206206
207- return postcss ( config . plugins ) . process ( css , options ) . then ( result => {
208- const tasks = [ ]
209-
210- if ( options . to ) {
211- tasks . push ( fs . outputFile ( options . to , result . css ) )
212-
213- if ( result . map ) {
214- tasks . push (
215- fs . outputFile (
216- options . to . replace (
217- path . extname ( options . to ) ,
218- `${ path . extname ( options . to ) } .map`
219- ) ,
220- result . map
207+ return postcss ( config . plugins )
208+ . process ( css , options )
209+ . then ( result => {
210+ const tasks = [ ]
211+
212+ if ( options . to ) {
213+ tasks . push ( fs . outputFile ( options . to , result . css ) )
214+
215+ if ( result . map ) {
216+ tasks . push (
217+ fs . outputFile (
218+ options . to . replace (
219+ path . extname ( options . to ) ,
220+ `${ path . extname ( options . to ) } .map`
221+ ) ,
222+ result . map
223+ )
221224 )
225+ }
226+ } else {
227+ spinner . text = chalk . bold . green (
228+ `Finished ${ relativePath } (${ prettyHrtime ( process . hrtime ( time ) ) } )`
222229 )
230+ spinner . succeed ( )
231+ return process . stdout . write ( result . css , 'utf8' )
223232 }
224- } else {
225- spinner . text = chalk . bold . green (
226- `Finished ${ relativePath } (${ prettyHrtime ( process . hrtime ( time ) ) } )`
227- )
228- spinner . succeed ( )
229- return process . stdout . write ( result . css , 'utf8' )
230- }
231233
232- return Promise . all ( tasks ) . then ( ( ) => {
233- spinner . text = chalk . bold . green (
234- `Finished ${ relativePath } (${ prettyHrtime ( process . hrtime ( time ) ) } )`
235- )
236- if ( result . warnings ( ) . length ) {
237- spinner . fail ( )
238- console . warn ( reporter ( result ) )
239- } else spinner . succeed ( )
234+ return Promise . all ( tasks ) . then ( ( ) => {
235+ spinner . text = chalk . bold . green (
236+ `Finished ${ relativePath } (${ prettyHrtime ( process . hrtime ( time ) ) } )`
237+ )
238+ if ( result . warnings ( ) . length ) {
239+ spinner . fail ( )
240+ console . warn ( reporter ( result ) )
241+ } else spinner . succeed ( )
240242
241- return result
243+ return result
244+ } )
242245 } )
243- } )
244246 } )
245247 . catch ( err => {
246248 spinner . fail ( )
0 commit comments