Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

A useful hot reload method for Big Top #3

@ghost

Description

Since your project is a very useful and convenient starter of universal application. A hot reload with Ionic Serve and Electron development is very essential. Herewith the gulpfile.js, hope you may find it useful for further automate / 'lazy' dev.

const gulp = require('gulp')
const electron = require('electron-connect').server.create()
const config = require('@ionic/app-scripts/dist/util/config')
const ionic = require('@ionic/app-scripts')

gulp.task('electron-live', function () {
  // Start browser process
  electron.start()

  gulp.watch('src/app.js', electron.restart)

  // Reload renderer process
  gulp.watch([
    'www/js/app.js',
    'www/**/*.html',
    'www/**/*.css',
    'www/**/*.js'], electron.reload)
})

gulp.task('dev', function () {
  ionic.watch(config.generateContext())
  .then(function () {
    gulp.start('electron-live')
  })
  .catch(function (err) {
    console.log('Error starting watch: ', err)
  })
})

The above code may help us to dev ionic in electron with hot reload, just run gulp dev and everything will go on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions