Skip to content

Instantly share code, notes, and snippets.

@wutipong
Created June 13, 2018 12:21
Show Gist options
  • Save wutipong/35f6301de0eea072cf8822e2c717fa78 to your computer and use it in GitHub Desktop.
Save wutipong/35f6301de0eea072cf8822e2c717fa78 to your computer and use it in GitHub Desktop.
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
// JS import
import Vue from 'vue';
import App from './App.vue'
import BootstrapVue from 'bootstrap-vue'
Vue.use(BootstrapVue);
new Vue({
el: '#app',
render: h => h(App)
})
const { app, BrowserWindow } = require("electron");
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win;
function createWindow() {
// Create the browser window.
win = new BrowserWindow({ width: 800, height: 600 });
// and load the index.html of the app.
win.loadFile("index.html");
// Open the DevTools.
win.webContents.openDevTools();
// Emitted when the window is closed.
win.on("closed", () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on("ready", createWindow);
// Quit when all windows are closed.
app.on("window-all-closed", () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== "darwin") {
app.quit();
}
});
app.on("activate", () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
{
"name": "tool",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"dev": "webpack",
"start": "electron ."
},
"license": "MIT",
"private": true,
"dependencies": {
"bootstrap-vue": "^2.0.0-rc.11"
},
"devDependencies": {
"css-loader": "^0.25.0",
"electron": "^1.4.3",
"electron-reload": "^1.0.2",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^0.9.0",
"jquery": "^3.3.1",
"postcss-base64": "^0.7.1",
"postcss-cssnext": "^3.1.0",
"postcss-import": "^11.1.0",
"postcss-loader": "^2.1.5",
"postcss-smart-import": "^0.7.6",
"postcss-url": "^7.3.2",
"style-loader": "^0.21.0",
"vue": "^2.5.16",
"vue-loader": "^9.5.1",
"webpack": "^3.4.1"
}
}
var path = require("path");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
watch: true,
target: "electron",
entry: "./app/src/entry.js",
output: {
path: __dirname + "/app/build",
publicPath: "build/",
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallback: "style-loader",
use: [
{
loader: "css-loader",
options: { importLoaders: 1 }
}
]
})
},
{
test: /\.vue$/,
loader: "vue-loader"
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: "file-loader",
query: {
name: "[name].[ext]?[hash]"
}
},
{
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
use: ["file-loader"]
}
]
},
resolve: {
alias: { vue: "vue/dist/vue.js" }
},
plugins: [new ExtractTextPlugin("[name].css")]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment