0

Is there any solution I can make gulp working on my server without me needing to connect with SSH and the writing gulp js:watch sass:watch ? This is my current gulpconfig.js

var gulp = require('gulp');
var sass = require('gulp-sass');
var sassGlob = require('gulp-sass-glob');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');

gulp.task('js:build', function() {
  gulp.src('js/*.js')
    .pipe(concat('functions.js'))
    .pipe(uglify())
    .pipe(gulp.dest('./js/'))
});

gulp.task('js:watch', function() {
    gulp.watch('js/*.js', ['js:build'])
});

gulp.task('sass:build', function () {
    return gulp
        .src('css/global.scss')
        .pipe(sassGlob())
        .pipe(sass())
        .pipe(gulp.dest('css'));
});

gulp.task('sass:watch', function() {
    gulp.watch('css/**/*.scss', ['sass:build'])
});
KangJiYoung13
  • 330
  • 4
  • 12
  • Screen is exactly the tool you are looking for: http://stackoverflow.com/questions/431521/run-a-command-in-a-shell-and-keep-running-the-command-when-you-close-the-session – Johannes Reuter Jul 09 '16 at 10:21
  • look into PM2 once you get sick of screen. i certainly never looked back... – dandavis Jul 09 '16 at 10:39

2 Answers2

0

The screen program for linux is exactly what you are looking for:

  • Install screen
  • Open a new screen session: screen -dR
  • Start gulp
  • Disconnect from your screen session: CTRL-A, d

Run a command in a shell and keep running the command when you close the session

Community
  • 1
  • 1
Johannes Reuter
  • 3,501
  • 19
  • 20
0

you can run your script in background by appending &

//pointing to startMyWebsite.sh
./startMyWebsite &
eyurdakul
  • 894
  • 2
  • 12
  • 29