Skip to content

Commit b545028

Browse files
committed
nuxt.js installiert, erste lauffähige SPA
1 parent 4041a05 commit b545028

21 files changed

+12378
-574
lines changed

.eslintrc.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
node: true
6+
},
7+
parserOptions: {
8+
parser: 'babel-eslint'
9+
},
10+
extends: [
11+
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
12+
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
13+
'plugin:vue/essential'
14+
],
15+
// required to lint *.vue files
16+
plugins: [
17+
'vue'
18+
],
19+
// add your custom rules here
20+
rules: {
21+
"indent": ["error", "tab"],
22+
"no-tabs": 0
23+
}
24+
}

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1+
# dependencies
12
/node_modules
3+
4+
# logs
5+
npm-debug.log
6+
7+
# Nuxt build
8+
.nuxt
9+
10+
# Nuxt generate
11+
dist
12+
13+
# Mac OS
14+
.DS_Store

Readme.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
# Obed
22

33
GUI für diverse Scripts, die für die Aufnahme benötigt werden.
4+
5+
## Build Setup
6+
7+
``` bash
8+
# install dependencies
9+
$ npm install
10+
11+
# development with vue devtools
12+
$ npm run dev
13+
14+
# build for production
15+
$ npm run build

assets/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ASSETS
2+
3+
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
4+
5+
More information about the usage of this directory in the documentation:
6+
https://nuxtjs.org/guide/assets#webpacked
7+
8+
**This directory is not required, you can delete it if you don't want to use it.**

assets/css/color.css

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:root {
2+
--primary: #00b786;
3+
--secondary: #8ceaf6;
4+
}

assets/css/global.css

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@import './color.css';
2+
html {
3+
font-size: 16px;
4+
word-spacing: 1px;
5+
-ms-text-size-adjust: 100%;
6+
-webkit-text-size-adjust: 100%;
7+
-moz-osx-font-smoothing: grayscale;
8+
-webkit-font-smoothing: antialiased;
9+
box-sizing: border-box;
10+
}
11+
body {
12+
font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
13+
}
14+
*, *:before, *:after {
15+
box-sizing: border-box;
16+
margin: 0;
17+
}
18+
.btn, .pointer {
19+
cursor: pointer;
20+
}
21+
.primary {
22+
color: var(--primary);
23+
}
24+
.secondary {
25+
color: var(--secondary);
26+
}
27+
.btn-primary {
28+
background-color: var(--primary);
29+
color: #fff;
30+
}
31+
.btn-secondary {
32+
background-color: var(--secondary);
33+
color: #000;
34+
}

assets/img/icon.jpg

18.4 KB
Loading

assets/img/icon.png

78.2 KB
Loading

assets/img/icon.xcf

116 KB
Binary file not shown.

components/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# COMPONENTS
2+
3+
The components directory contains your Vue.js Components.
4+
Nuxt.js doesn't supercharge these components.
5+
6+
**This directory is not required, you can delete it if you don't want to use it.**

layouts/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# LAYOUTS
2+
3+
This directory contains your Application Layouts.
4+
5+
More information about the usage of this directory in the documentation:
6+
https://nuxtjs.org/guide/views#layouts
7+
8+
**This directory is not required, you can delete it if you don't want to use it.**

layouts/default.vue

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<div>
3+
<nuxt/>
4+
</div>
5+
</template>
6+
7+
<!-- <script src="../node_modules/popper.js/dist/popper.min.js"></script> -->
8+
<!-- <script src="../node_modules/jquery/dist/jquery.js"></script> -->
9+
<!-- <script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script> -->
10+
11+
<style lang="css">
12+
@import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
13+
</style>

main.js

+52-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,60 @@
1+
/*
2+
** Nuxt
3+
*/
4+
const http = require('http')
5+
const { Nuxt, Builder } = require('nuxt')
6+
let config = require('./nuxt.config.js')
7+
config.rootDir = __dirname // for electron-builder
8+
// Init Nuxt.js
9+
const nuxt = new Nuxt(config)
10+
const builder = new Builder(nuxt)
11+
const server = http.createServer(nuxt.render)
12+
// Build only in dev mode
13+
if (config.dev) {
14+
builder.build().catch(err => {
15+
console.error(err) // eslint-disable-line no-console
16+
process.exit(1)
17+
})
18+
}
19+
// Listen the server
20+
server.listen()
21+
const _NUXT_URL_ = `http://localhost:${server.address().port}`
22+
console.log(`Nuxt working on ${_NUXT_URL_}`)
23+
/*
24+
** Electron
25+
*/
126
const { app, BrowserWindow } = require('electron')
2-
27+
let win = null // Current window
28+
const path = require('path')
329
function createWindow () {
430
// Erstelle das Browser-Fenster.
5-
let win = new BrowserWindow({
6-
width: 800,
7-
height: 600,
31+
win = new BrowserWindow({
832
webPreferences: {
9-
nodeIntegration: false
10-
}
33+
nodeIntegration: true
34+
},
35+
icon: path.join(__dirname, 'static/icon.png')
1136
})
12-
13-
// und lade die index.html der App.
14-
win.loadFile('index.html')
37+
win.maximize()
38+
win.on('closed', () => win = null)
39+
if (config.dev) {
40+
// Install vue dev tool and open chrome dev tools
41+
const { default: installExtension, VUEJS_DEVTOOLS } = require('electron-devtools-installer')
42+
installExtension(VUEJS_DEVTOOLS.id).then(name => {
43+
console.log(`Added Extension: ${name}`)
44+
win.webContents.openDevTools()
45+
}).catch(err => console.log('An error occurred: ', err))
46+
// Wait for nuxt to build
47+
const pollServer = () => {
48+
http.get(_NUXT_URL_, (res) => {
49+
if (res.statusCode === 200) { win.loadURL(_NUXT_URL_) } else { setTimeout(pollServer, 300) }
50+
}).on('error', pollServer)
51+
}
52+
pollServer()
53+
} else {
54+
return win.loadURL(_NUXT_URL_)
55+
}
1556
}
1657

1758
app.whenReady().then(createWindow)
59+
app.on('window-all-closed', () => app.quit())
60+
app.on('activate', () => win === null && newWin())

nuxt.config.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
mode: 'spa',
3+
telemetry: false,
4+
// Headers of the page
5+
head: {
6+
title: 'Obed',
7+
meta: [
8+
{ charset: 'utf-8' },
9+
{ name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no' },
10+
]
11+
},
12+
loading: false, // Disable default loading bar
13+
build: {
14+
extend (config, { isDev, isClient }) {
15+
if (isDev && isClient) {
16+
// Run ESLint on save
17+
config.module.rules.push({
18+
enforce: 'pre',
19+
test: /\.(js|vue)$/,
20+
loader: 'eslint-loader',
21+
exclude: /(node_modules)/
22+
})
23+
}
24+
// Extend only webpack config for client-bundle
25+
if (isClient) { config.target = 'electron-renderer' }
26+
}
27+
},
28+
dev: process.env.NODE_ENV === 'DEV',
29+
css: [
30+
'@/assets/css/global.css'
31+
]
32+
}

0 commit comments

Comments
 (0)