2016-04-07 13 views
0

を実行した後に終了します。ガルプは私が生きしかし実行した後、以下のように終了を飲み込むと、サーバー</p> <p>cmdの出力をヒットすることはできませんよゴクゴク</p> <p>を使用して明示サーバーで作業をリロード取得しようとしています

D:\ Users \ユーザーのワークスペース\サーバー\

をgulpfile.js [11時31分56秒] 'サーバー' を起動する:gulpfile Dを使用して\ Users \ユーザーのワークスペース\サーバー>一気サーバ [11時31分56秒] ...

[午前11時31分56秒] 26ミリ

livereload [小さな-LR] ... 35729でリッスン

D後の完成 'サーバ':\ Users \ユーザーのワークスペース\サーバー>

gulpfile.js:

var gulp = require('gulp'); 
var server = require('gulp-express'); 

gulp.task('server', function() { 
    // Start the server at the beginning of the task 
server.run(['app.js']); 

// Restart the server when file changes 
gulp.watch(['app/**/*.html'], server.notify); 
gulp.watch(['app/styles/**/*.scss'], ['styles:scss']); 
//gulp.watch(['{.tmp,app}/styles/**/*.css'], ['styles:css', server.notify]); 
//Event object won't pass down to gulp.watch's callback if there's more than one of them. 
//So the correct way to use server.notify is as following: 
gulp.watch(['{.tmp,app}/styles/**/*.css'], function(event){ 
    gulp.run('styles:css'); 
    server.notify(event); 
    //pipe support is added for server.notify since v0.1.5, 
    //see https://github.com/gimm/gulp-express#servernotifyevent 
}); 

gulp.watch(['app/scripts/**/*.js'], ['jshint']); 
gulp.watch(['app/images/**/*'], server.notify); 
gulp.watch(['app.js', 'routes/**/*.js'], [server.run]); 
}); 

gulp.task('default', ['server']); 

gulpjs tutplus

私が冗談を言う方法に根本的に間違ったことはありますか?

+1

'gulp-express'は廃止され、今年は維持されていません。代わりに['gulp-live-server'](https://github.com/gimm/gulp-live-server)を使用してください。 –

+0

あなたはライブリロードとはどういう意味ですか? – gh0st

答えて

0

でも、ライブリロードの作業に問題がありました。したがって、私はgulp-nodemonを使用してWebサーバーを作成し、リロードを開始しました。私が持っている仕事は以下の通りです:

gulp.task('server', function(){ 
     var nodeOptions = { 
      script:"",//path to the app.js or server.js 
      delayTime: 1, 
      env: { 
       'PORT': 8088 //port that you want to run it on 
      }, 
      watch: ['filesToBeWatched.js'] //files to be watched for changes 
     }; 

     return nodemon(nodeOptions) 
      .on('restart', function(event){ 
       console.log('Node Server RESTARTED'); 
      }) 
      .on('start', function(){ 
       console.log('Node Server STARTED'); 
       startBrowserSync(); 
      }) 
      .on('crash', function() { 
       console.log('Node Server CRASHED'); 
      }) 
      .on('exit', function() { 
       console.log('Node Server EXISTED') 
      }); 

    }); 
関連する問題

 関連する問題