Add client side components
This commit is contained in:
parent
0f01d2ad01
commit
329fa48fc1
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,6 +5,8 @@
|
||||
/coverage/
|
||||
/docs/
|
||||
/lib/
|
||||
/node_modules/
|
||||
/var/
|
||||
/tmp/
|
||||
*.dwarf
|
||||
*.sublime*
|
||||
|
32
assets/App.vue
Normal file
32
assets/App.vue
Normal file
@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<div id="nav">
|
||||
<router-link to="/">Home</router-link> |
|
||||
<router-link to="/about">About</router-link>
|
||||
</div>
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
#app {
|
||||
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
#nav {
|
||||
padding: 30px;
|
||||
|
||||
a {
|
||||
font-weight: bold;
|
||||
color: #2c3e50;
|
||||
|
||||
&.router-link-exact-active {
|
||||
color: #42b983;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
BIN
assets/assets/logo.png
Normal file
BIN
assets/assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
130
assets/components/HelloWorld.vue
Normal file
130
assets/components/HelloWorld.vue
Normal file
@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<p>
|
||||
For a guide and recipes on how to configure / customize this project,<br />
|
||||
check out the
|
||||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener"
|
||||
>vue-cli documentation</a
|
||||
>.
|
||||
</p>
|
||||
<h3>Installed CLI Plugins</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>babel</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>router</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>vuex</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>eslint</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Essential Links</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://forum.vuejs.org" target="_blank" rel="noopener"
|
||||
>Forum</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://chat.vuejs.org" target="_blank" rel="noopener"
|
||||
>Community Chat</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener"
|
||||
>Twitter</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Ecosystem</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://router.vuejs.org" target="_blank" rel="noopener"
|
||||
>vue-router</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://github.com/vuejs/vue-devtools#vue-devtools"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>vue-devtools</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener"
|
||||
>vue-loader</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://github.com/vuejs/awesome-vue"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>awesome-vue</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "HelloWorld",
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped lang="scss">
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
12
assets/main.js
Normal file
12
assets/main.js
Normal file
@ -0,0 +1,12 @@
|
||||
import Vue from "vue";
|
||||
import App from "./App.vue";
|
||||
// import router from "./router";
|
||||
// import store from "./store";
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
new Vue({
|
||||
// router,
|
||||
// store,
|
||||
render: h => h(App)
|
||||
}).$mount("#app");
|
11
assets/store/index.js
Normal file
11
assets/store/index.js
Normal file
@ -0,0 +1,11 @@
|
||||
import Vue from "vue";
|
||||
import Vuex from "vuex";
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
modules: {}
|
||||
});
|
5
assets/views/About.vue
Normal file
5
assets/views/About.vue
Normal file
@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div class="about">
|
||||
<h1>This is an about page</h1>
|
||||
</div>
|
||||
</template>
|
18
assets/views/Home.vue
Normal file
18
assets/views/Home.vue
Normal file
@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<img alt="Vue logo" src="../assets/logo.png" />
|
||||
<HelloWorld msg="Welcome to Your Vue.js App" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// @ is an alias to /src
|
||||
import HelloWorld from "../components/HelloWorld.vue";
|
||||
|
||||
export default {
|
||||
name: "home",
|
||||
components: {
|
||||
HelloWorld
|
||||
}
|
||||
};
|
||||
</script>
|
7217
package-lock.json
generated
Normal file
7217
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
47
package.json
Normal file
47
package.json
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "homepage",
|
||||
"author": "Anton Vakhrushev",
|
||||
"license": "",
|
||||
"version": "1.0.0",
|
||||
"description": "Homepage",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.7.2",
|
||||
"@babel/plugin-proposal-class-properties": "^7.5.0",
|
||||
"@babel/plugin-transform-runtime": "^7.6.2",
|
||||
"@babel/preset-env": "^7.6.3",
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"autoprefixer": "^9.7.0",
|
||||
"babel-loader": "^8.0.0",
|
||||
"css-loader": "^2.1.1",
|
||||
"glob": "^7.1.6",
|
||||
"mini-css-extract-plugin": "^0.6.0",
|
||||
"node-sass": "^4.13.0",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"prettier": "^1.18.2",
|
||||
"sass-loader": "^7.3.1",
|
||||
"style-loader": "^0.23.1",
|
||||
"underscore": "^1.9.1",
|
||||
"vue": "^2.6.10",
|
||||
"vue-loader": "^15.7.1",
|
||||
"vue-style-loader": "^4.1.2",
|
||||
"vue-template-compiler": "^2.6.10",
|
||||
"webpack": "^4.41.2",
|
||||
"webpack-cli": "^3.3.9"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --config webpack.config.js --progress",
|
||||
"build-prod": "webpack --config webpack.config.js --env.production",
|
||||
"format-webpack": "prettier --single-quote --trailing-comma es5 --write \"./webpack.config.js\"",
|
||||
"format-js": "prettier --single-quote --trailing-comma es5 --write \"./source/_assets/**/*.js\"",
|
||||
"format-vue": "prettier --single-quote --trailing-comma es5 --write \"./source/_assets/**/*.vue\"",
|
||||
"format-style": "prettier --single-quote --write \"source/_assets/**/*.scss\"",
|
||||
"format-md": "prettier --print-width=80 --parser=markdown --write \"source/**/*.md\""
|
||||
},
|
||||
"dependencies": {},
|
||||
"browserslist": [
|
||||
"last 5 version",
|
||||
"> 1%",
|
||||
"maintained node versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
18
public/assets/main.css
Normal file
18
public/assets/main.css
Normal file
@ -0,0 +1,18 @@
|
||||
#app {
|
||||
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
#nav {
|
||||
padding: 30px;
|
||||
}
|
||||
#nav a {
|
||||
font-weight: bold;
|
||||
color: #2c3e50;
|
||||
}
|
||||
#nav a.router-link-exact-active {
|
||||
color: #42b983;
|
||||
}
|
||||
|
228
public/assets/main.js
Normal file
228
public/assets/main.js
Normal file
File diff suppressed because one or more lines are too long
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
15
public/index.html
Normal file
15
public/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="/assets/main.css">
|
||||
<title>dayoff</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script type="text/javascript" src="/assets/main.js"></script>
|
||||
</html>
|
17
tools/nodejs
Executable file
17
tools/nodejs
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p var/docker-cache/.npm
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
--interactive \
|
||||
--tty \
|
||||
--user "$UID:$(id -g)" \
|
||||
--volume /etc/passwd:/etc/passwd:ro \
|
||||
--volume /etc/group:/etc/group:ro \
|
||||
--volume "$PWD:/app" \
|
||||
--volume "$PWD/var/docker-cache/.npm:/tmp/.npm" \
|
||||
--env npm_config_cache=/tmp/.npm \
|
||||
--workdir /app \
|
||||
node:12.13-alpine \
|
||||
"$@"
|
103
webpack.config.js
Normal file
103
webpack.config.js
Normal file
@ -0,0 +1,103 @@
|
||||
const path = require('path');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
module.exports = (env = {}) => {
|
||||
const is_prod = !!env.production;
|
||||
|
||||
const STYLE_LOADER = { loader: 'style-loader' };
|
||||
|
||||
const CSS_LOADER = {
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
importLoaders: true,
|
||||
},
|
||||
};
|
||||
|
||||
const POSTCSS_LOADER = {
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
plugins: [autoprefixer()],
|
||||
},
|
||||
};
|
||||
|
||||
const SCSS_LOADER = { loader: 'sass-loader' };
|
||||
|
||||
const MINI_CSS_LOADER = MiniCssExtractPlugin.loader;
|
||||
|
||||
const BABEL_LOADER = {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env'],
|
||||
plugins: [
|
||||
'@babel/plugin-transform-runtime',
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const VUE_LOADER = {
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
loaders: {
|
||||
css: [
|
||||
MINI_CSS_LOADER, //'vue-style-loader',
|
||||
CSS_LOADER,
|
||||
POSTCSS_LOADER,
|
||||
],
|
||||
scss: [
|
||||
MINI_CSS_LOADER, //'vue-style-loader',
|
||||
CSS_LOADER,
|
||||
POSTCSS_LOADER,
|
||||
SCSS_LOADER,
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
mode: is_prod ? 'production' : 'development',
|
||||
entry: './assets/main.js',
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
path: path.resolve(__dirname, './public/assets/'),
|
||||
publicPath: '/assets/'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: [BABEL_LOADER],
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [MINI_CSS_LOADER, CSS_LOADER, POSTCSS_LOADER],
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
MINI_CSS_LOADER,
|
||||
CSS_LOADER,
|
||||
POSTCSS_LOADER,
|
||||
SCSS_LOADER,
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
use: [VUE_LOADER],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new MiniCssExtractPlugin({
|
||||
// Options similar to the same options in webpackOptions.output
|
||||
// both options are optional
|
||||
filename: '[name].css',
|
||||
// chunkFilename: "[id].css"
|
||||
}),
|
||||
],
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user