2017-12-30 35 views
3

을 변경할 때 꿀꺽 내가이 내 server.js (서버 측) 파일이 변경된 경우에만 쭉 마시는를 다시로드 할난 내 프론트 엔드 (AngularJS와) 컨트롤러 파일

// Dependencies 
var gulp = require('gulp'); 
var nodemon = require('gulp-nodemon'); 
// var notify = require('gulp-notify'); 
var livereload = require('gulp-livereload'); 

// Task 
gulp.task('default', function() { 
    // listen for changes 
    livereload.listen(); 
    // configure nodemon 
    nodemon({ 
     // the script to run the app 
     script: 'server.js', 
     ext: 'js' 
    }).on('restart', function() { 
     // when the app has restarted, run livereload. 
     gulp.src('server.js') 
     .pipe(livereload()) 
     // .pipe(notify('Reloading page, please wait...')); 
    }) 
}) 

gulpfile.js이 서버를 다시 시작,

그러나 내가 angularjs의 프런트 엔드 파일을 변경 한 경우 controller.js, 서버를 다시 시작합니다.

해결 방법? 내가 클라이언트 측 파일을 변경할 때

답변

0

가 나는 nodemon 옵션은 서버를 다시 시작 스틸

nodemon({ 
    // the script to run the app 
    script: 'server.js', 
    // comment or remove this line ext: 'js', 
    ignore: ['js/controller.js'], // you can also specify directories/files to ignore 
    // add watch array here 
    watch: [ 
    //directories that you want to watch ex: src/**/*.js 
    'server.js' // you can be as specific as you want try this. 
    ] 
}).on('restart', function() { 
    // when the app has restarted, run livereload. 
    gulp.src('server.js') 
     .pipe(livereload()) 
// .pipe(notify('Reloading page, please wait...')); 
}) 
+0

보고 사용합니다. –

+0

아마도 라이브로드 일 가능성이 높습니다. 모든 파일을보고 있다고 생각합니다. 내 대답을 편집 할게. – RickyM

+0

은 여전히 ​​클라이언트 측을 다시로드합니다. '( –