@@ -10,7 +10,6 @@ import {
10
10
EnvPlugin ,
11
11
WebIndexPlugin
12
12
} from 'fuse-box'
13
- import { exec , task , watch } from 'fuse-box/sparky'
14
13
import { resolve } from 'path'
15
14
import { NgProdPlugin } from '../fusebox/ng.prod.plugin'
16
15
import { NgPolyfillPlugin } from '../fusebox/ng.polyfill.plugin'
@@ -20,8 +19,8 @@ import { NgAotFactoryPlugin } from '../fusebox/ng.aot-factory.plugin'
20
19
import { main as ngc } from '@angular/compiler-cli/src/main'
21
20
import { CompressionPlugin } from '../fusebox/compression.plugin'
22
21
import { appEnvironmentVariables } from '../utilities/environment-variables'
23
- import { renderSingleSass , renderSassDir } from '../utilities/sass'
24
- import { SparkyFile } from 'fuse-box/sparky/SparkyFile '
22
+ import { renderSassDir } from '../utilities/sass'
23
+ import { exec } from 'child_process '
25
24
import clearTerminal from '../utilities/clear'
26
25
import readConfig_ from '../utilities/read-config'
27
26
@@ -66,7 +65,7 @@ function serve(isProdBuild = false) {
66
65
const serverOutput = resolve ( config . fusebox . server . outputDir )
67
66
const browserOutput = resolve ( config . fusebox . browser . outputDir )
68
67
const modulesFolder = resolve ( process . cwd ( ) , 'node_modules' )
69
- const watchDir = `${ homeDir } /src/**`
68
+ const watchDir = resolve ( `${ homeDir } /src/**` )
70
69
const browserModule = isAotBuild
71
70
? config . fusebox . browser . aotBrowserModule
72
71
: config . fusebox . browser . browserModule
@@ -181,17 +180,26 @@ function serve(isProdBuild = false) {
181
180
. instructions ( ` !> [${ browserModule } ]` )
182
181
. splitConfig ( { dest : '../js/modules' } )
183
182
184
- task ( 'scss.watch' , ( ) =>
185
- watch ( 'src/**/**.*' ) . file ( '*.scss' , ( f : SparkyFile ) => {
186
- f . homePath && renderSingleSass ( f . homePath )
187
- } )
188
- )
189
-
190
- exec ( 'scss.watch' )
191
-
192
183
logInfo ( 'Bundling your application, this may take some time...' )
193
184
194
185
renderSassDir ( )
195
- fuseBrowser . run ( { chokidar : { ignored : / .s c s s / g } } )
186
+
187
+ const sass = exec (
188
+ 'node_modules/.bin/node-sass --watch src/**/*.scss --output-style compressed --output src/**'
189
+ )
190
+ sass . on ( 'error' , err => {
191
+ console . log ( err )
192
+ process . exit ( 1 )
193
+ } )
194
+ sass . on ( 'message' , err => {
195
+ console . error ( err )
196
+ process . exit ( 1 )
197
+ } )
198
+ sass . stderr . on ( 'data' , err => {
199
+ console . log ( err )
200
+ process . exit ( 1 )
201
+ } )
202
+
203
+ fuseBrowser . run ( { chokidar : { ignored : / ^ ( .* \. s c s s $ ) * $ / gim } } )
196
204
} )
197
205
}
0 commit comments