Initial commit
commit
716f6946a7
@ -0,0 +1,9 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true, //sets this file as the parent scope for the rules
|
||||||
|
parserOptions:{
|
||||||
|
sourceType: 'module'
|
||||||
|
},
|
||||||
|
extends: 'standard',
|
||||||
|
//required to lint *.vue files
|
||||||
|
plugins: [
|
||||||
|
'html'
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
dist/*.js
|
||||||
|
dist/*.css
|
@ -0,0 +1,8 @@
|
|||||||
|
MIT License
|
||||||
|
Copyright (c) 2017 Drew Bednar
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -0,0 +1,24 @@
|
|||||||
|
# Vuejs SPA
|
||||||
|
|
||||||
|
A Vuejs SPA application
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
`npm install`
|
||||||
|
|
||||||
|
## Dev server
|
||||||
|
|
||||||
|
`npm start`
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Webpack build process
|
||||||
|
- ESLinting
|
||||||
|
- Dev live reloading
|
||||||
|
- Routing
|
||||||
|
- State management
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
@ -0,0 +1,25 @@
|
|||||||
|
const webpack = require('webpack')
|
||||||
|
const clientConfig = require('./webpack.client.config')
|
||||||
|
|
||||||
|
module.exports = function setupDevServer(app) {
|
||||||
|
//hot middleware
|
||||||
|
clientConfig.entry.app = [
|
||||||
|
'webpack-hot-middleware/client',
|
||||||
|
clientConfig.entry.app
|
||||||
|
]
|
||||||
|
|
||||||
|
clientConfig.plugins.push(
|
||||||
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
|
new webpack.NoEmitOnErrorsPlugin()
|
||||||
|
)
|
||||||
|
|
||||||
|
const clientCompiler = webpack(clientConfig)
|
||||||
|
app.use(
|
||||||
|
require('webpack-dev-middleware')(clientCompiler, {
|
||||||
|
stats:{
|
||||||
|
colors: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
app.use(require('webpack-hot-middleware')(clientCompiler))
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
entry: {
|
||||||
|
app: path.resolve(__dirname, '../src/client-entry.js')
|
||||||
|
},
|
||||||
|
|
||||||
|
//Path for output files
|
||||||
|
output:{
|
||||||
|
path: path.resolve(__dirname, '../dist'), //where we eventually deploy. Notice it's relative to this file location
|
||||||
|
publicPath: '/', //dist folder availble through our site through the root path
|
||||||
|
filename: 'assets/js/[name].js' //
|
||||||
|
},
|
||||||
|
|
||||||
|
//We do not want to use this in production because it
|
||||||
|
//instead we whatnt o make sure that all components are defined in *.vuejs
|
||||||
|
//files, because they are pre-compiled
|
||||||
|
resolve: { // What the hell does resolve do?
|
||||||
|
alias:{
|
||||||
|
vue: 'vue/dist/vue.js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
enforce: 'pre', //check source files before they are loader by other loaders
|
||||||
|
test: /(\.js$)/,
|
||||||
|
loader: 'eslint-loader',
|
||||||
|
exclude: /node_modules/
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = config
|
@ -0,0 +1,8 @@
|
|||||||
|
const base = require('./webpack.base.config')
|
||||||
|
|
||||||
|
//extends the base config object and include the new property plugins
|
||||||
|
const config = Object.assign({}, base, {
|
||||||
|
plugins: base.plugins || []
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = config
|
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Vuejs SPA</title>
|
||||||
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, width=device-width">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
{{ message }}
|
||||||
|
</div>
|
||||||
|
<script src="/assets/js/app.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "vuejs_spa",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "A Vuejs SPA application",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node server",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Drew Bednar",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.16.2",
|
||||||
|
"vue": "^2.5.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^4.5.0",
|
||||||
|
"eslint-config-standard": "^10.2.1",
|
||||||
|
"eslint-loader": "^1.9.0",
|
||||||
|
"eslint-plugin-html": "^3.2.0",
|
||||||
|
"eslint-plugin-import": "^2.7.0",
|
||||||
|
"eslint-plugin-node": "^5.1.1",
|
||||||
|
"eslint-plugin-promise": "^3.5.0",
|
||||||
|
"eslint-plugin-standard": "^3.0.1",
|
||||||
|
"webpack": "^3.8.1",
|
||||||
|
"webpack-dev-middleware": "^1.12.0",
|
||||||
|
"webpack-hot-middleware": "^2.20.0"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const indexHTML = (() => {
|
||||||
|
//path.resolve helps us locate the file relative to the server.js file
|
||||||
|
return fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf-8");
|
||||||
|
})(); //iffy
|
||||||
|
|
||||||
|
//used to retrun all static modules from the dist folder
|
||||||
|
app.use("/dist", express.static(path.resolve(__dirname, "./dist")));
|
||||||
|
|
||||||
|
//this extends the server with two new modules in the setupdeverser method
|
||||||
|
require("./build/dev-server")(app);
|
||||||
|
|
||||||
|
app.get('*', (req, res) => {
|
||||||
|
res.write(indexHTML);
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const port = process.env.PORT || 3000;
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`Server started at http://localhost:${port}`);
|
||||||
|
});
|
@ -0,0 +1,10 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
const app = new Vue({
|
||||||
|
data: {
|
||||||
|
message: 'Hello Vue'
|
||||||
|
},
|
||||||
|
template: '<div id="app">{{ message }}</div>'
|
||||||
|
})
|
||||||
|
|
||||||
|
export { app }
|
@ -0,0 +1,8 @@
|
|||||||
|
import { app } from './app'
|
||||||
|
|
||||||
|
// We can use the $mount when we didn't specify the el property name
|
||||||
|
app.$mount('#app')
|
||||||
|
|
||||||
|
if (module.hot) {
|
||||||
|
module.hot.accept()
|
||||||
|
}
|
Loading…
Reference in New Issue