File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -261,5 +261,24 @@ gulp.task("terriajs-server", terriajsServerGulpTask(3001));
261261gulp . task ( "build" , gulp . series ( "copy-terriajs-assets" , "build-app" ) ) ;
262262gulp . task ( "release" , gulp . series ( "copy-terriajs-assets" , "release-app" ) ) ;
263263gulp . task ( "watch" , gulp . parallel ( "watch-terriajs-assets" , "watch-app" ) ) ;
264- gulp . task ( "dev" , gulp . parallel ( "watch" , "terriajs-server" ) ) ;
264+ // Simple task that waits for index.html then starts server
265+ gulp . task (
266+ "dev" ,
267+ gulp . parallel ( "watch" , function startServerWhenReady ( done ) {
268+ const indexFile = path . join ( __dirname , "wwwroot" , "index.html" ) ;
269+
270+ if ( fs . existsSync ( indexFile ) ) {
271+ terriajsServerGulpTask ( 3001 ) ( done ) ;
272+ return ;
273+ }
274+ var watcher = gulp . watch (
275+ path . join ( __dirname , "wwwroot" , "index.html" ) ,
276+ watchOptions
277+ ) ;
278+ watcher . on ( "add" , function ( ) {
279+ watcher . close ( ) ;
280+ terriajsServerGulpTask ( 3001 ) ( done ) ;
281+ } ) ;
282+ } )
283+ ) ;
265284gulp . task ( "default" , gulp . series ( "lint" , "build" ) ) ;
You can’t perform that action at this time.
0 commit comments