Electron step on those pits

Everything is ready to open in accordance with the example kailu

The question is, can not always have to manually restart the service to modify or Ctrl + R to refresh the application of it, too delayed things.

Resolve to do it and install gulp gulp-watch and electron-connect module

Creating gulpfile.js follows

const gulp = require('gulp')
const watch = require('gulp-watch')
const electron = require('electron-connect').server.create()

gulp.task('watch:electron', function(){
    electron.start()
    watch(['./main.js'], electron.restart)
    watch(['./index.html'], electron.reload)
})

gulp electron: electron to start the task, and then modify main.js normal restart, and then try to modify index.html, heavy-duty Starting 'bound' ... card here

JS solution requires a code inserted inside index.html

<script>require('electron-connect').client.create()</script>

Re-test all normal.

Packaged next test

npm install electron-packager

Configuration package.json

  "scripts": {
    "pack": "electron-packager . myClient --platform=win32  --arch=x64 --app-version=0.0.1 --electron-version=4.0.5 --ignore=node_modules"
  },

npm run pack Note parameters need to add --- ignore = node_modules otherwise stuck

Polymer items before due to the front end with

Polymer can start testing again Electron run up inside

npm install polymer-cli

polymer init

First select polymer2.0 operating normally

Since reselection polymer3.0 polymer3.0 introduced using the import module 

node does not support the need to import babel require only support the import mode is switched to require introducing

However, after transfer error retry

Finally, check Electron embedded in Chrome version 68, release date is August 2018, this time polymer3.0 not out, 68 may not support some features of it polymer3.0

 

Just seen in electron conduction community have electron-vue module, the front end so well since vue currently on fire with vue bar.

Guess you like

Origin blog.csdn.net/github_38108899/article/details/87537510