File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/pack/src/plugins Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -45,9 +45,7 @@ class CssPlugin implements Plugin {
4545 const files = await glob ( this . options . src , { cwd : ctx , ignore : this . options . ignore } )
4646 for ( const file of files ) {
4747 const rawContent = await readFile ( resolve ( ctx , file ) , 'utf-8' )
48- const content = this . availableCssProcessor ( processor )
49- ? processor . process ( rawContent , { from : '' , to : '' } )
50- : rawContent
48+ const content = await this . runCssProcessorIfAvailable ( rawContent , processor )
5149 const dirs = this . options . output ? this . options . output : [ output ]
5250 for ( const dir of dirs ) {
5351 const destPath = resolve ( context , dir , file )
@@ -59,6 +57,14 @@ class CssPlugin implements Plugin {
5957 done ( )
6058 }
6159
60+ private runCssProcessorIfAvailable ( rawContent : string , processor ?: Processor ) {
61+ if ( this . availableCssProcessor ( processor ) ) {
62+ return processor . process ( rawContent , { from : '' , to : '' } ) . then ( ( result ) => result . css )
63+ }
64+
65+ return Promise . resolve ( rawContent )
66+ }
67+
6268 private availableCssProcessor ( _p ?: Processor ) : _p is Processor {
6369 return this . options . postcssConfigPath !== undefined
6470 }
You can’t perform that action at this time.
0 commit comments