Tuesday 6 June 2017

The Console.logs of an Electron app runned by gulp are not shown

I'm starting to work with gulp. I have electron app that is invoked by a gulp process. The thing is that I wan't to be able to see the console.logs of the main.js process into the console where the gulp command was executed.

I'm able to see the console.logs of all the render processes in the dev tools.

My gulpfile is:

var gulp = require('gulp'),
  browserify = require('gulp-browserify'),
  concatCss = require('gulp-concat-css'),
  run = require('gulp-run');

var src = './process',
  app = './app';

gulp.task('js', function () {
  return gulp.src(src + '/js/render.js')
    .pipe(browserify({
      transform: 'reactify',
      extensions: 'browserify-css',
      debug: true
    }))
    .on('error', function (err) {
      console.error('Error!', err.message);
    })
    .pipe(gulp.dest(app + '/js'));
});

gulp.task('html', function () {
  gulp.src(src + '/**/*.html');
});

gulp.task('css', function () {
  gulp.src(src + '/css/*.css')
    .pipe(concatCss('app.css'))
    .pipe(gulp.dest(app + '/css'));
});

gulp.task('fonts', function () {
  gulp.src('node_modules/bootstrap/dist/fonts/**/*')
    .pipe(gulp.dest(app + '/fonts'));
});

gulp.task('watch', ['serve'], function () {
  gulp.watch(src + '/js/**/*', ['js']);
  gulp.watch(src + '/css/**/*.css', ['css']);
  gulp.watch([app + '/**/*.html'], ['html']);
});


gulp.task('serve', ['html', 'js', 'css'], function () {
  run('electron app/main.js').exec();
});

gulp.task('default', ['watch', 'fonts', 'serve']);

Any idea of what to do?



via joacoleza

No comments:

Post a Comment