diff --git a/.gitignore b/.gitignore
index 17a872d..8393979 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,3 @@
dist/
node_modules/
thumbs.db
-!.gitkeep
diff --git a/package.json b/package.json
index c447819..6b33db9 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,6 @@
{
"name": "electron-webpack-quick-start",
"version": "0.0.0",
- "main": "index.js",
"license": "MIT",
"scripts": {
"dev": "electron-webpack dev",
diff --git a/src/index.ejs b/src/index.ejs
deleted file mode 100644
index 37582e6..0000000
--- a/src/index.ejs
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
- <% if (htmlWebpackPlugin.options.nodeModules) { %>
-
-
- <% } %>
-
-
-
-
- Hello World!
-
- You are using Node.js ,
- Chromium ,
- Electron ,
- and electron-webpack
.
-
-
-
-
-
diff --git a/src/main/index.js b/src/main/index.js
index 44557fe..6a60c03 100644
--- a/src/main/index.js
+++ b/src/main/index.js
@@ -4,10 +4,17 @@ import { app, BrowserWindow } from 'electron'
const isDevelopment = process.env.NODE_ENV !== 'production'
+// Global reference to mainWindow
+// Neccessary to prevent win from being garbage collected
let mainWindow
function createMainWindow () {
+ // Construct new BrowserWindow
let win = new BrowserWindow()
+
+ // Set url for `win`
+ // points to `webpack-dev-server` in development
+ // points to `index.html` in production
let url = isDevelopment
? 'http://localhost:9080'
: `file://${__dirname}/index.html`
@@ -23,14 +30,20 @@ function createMainWindow () {
return win
}
+// Quit application when all windows are closed
app.on('window-all-closed', () => {
+ // On macOS it is common for applications to stay open
+ // until the user explicitly quits
if (process.platform !== 'darwin') app.quit()
})
app.on('activate', () => {
+ // On macOS it is common to re-create a window
+ // even after all windows have been closed
if (mainWindow === null) mainWindow = createMainWindow()
})
+// Create main BrowserWindow when electron is ready
app.on('ready', () => {
mainWindow = createMainWindow()
})
diff --git a/src/renderer/index.js b/src/renderer/index.js
index 3515c00..d267472 100644
--- a/src/renderer/index.js
+++ b/src/renderer/index.js
@@ -1,4 +1,10 @@
-document.getElementById('node').innerText = process.versions.node
-document.getElementById('chrome').innerText = process.versions.chrome
-document.getElementById('electron').innerText = process.versions.electron
-document.getElementById('electron-webpack').innerText = require('electron-webpack/package.json').version
+// Initial landing page
+document.write(`
+ Hello world!
+
+ You are using Node.js ${process.versions.node},
+ Chromium ${process.versions.chrome},
+ Electron ${process.versions.electron},
+ and electron-webpack
${require('electron-webpack/package.json').version}.
+
+`)