Skip to content

Commit ce78a01

Browse files
committed
initial commit
0 parents  commit ce78a01

File tree

12 files changed

+280
-0
lines changed

12 files changed

+280
-0
lines changed

.babelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": [["env", {
3+
"targets": {
4+
"browsers": ["last 2 versions"]
5+
}
6+
}]],
7+
"plugins": [
8+
["transform-object-rest-spread"]
9+
]
10+
}

.eslintignore

Whitespace-only changes.

.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
commonjs: true,
5+
es6: true
6+
},
7+
extends: 'airbnb-base',
8+
rules: {
9+
quotes: [2, 'single'],
10+
semi: 2,
11+
'max-len': [1, 120, 2],
12+
'arrow-body-style': [1, 'as-needed'],
13+
'comma-dangle': [2, 'never'],
14+
'no-debugger': 2,
15+
'no-console': 2,
16+
'object-curly-spacing': [2, 'always'],
17+
'no-undef': [1],
18+
'new-cap': 1,
19+
'no-param-reassign': 2,
20+
'global-require': 0,
21+
'no-mixed-operators': 0,
22+
"import/no-extraneous-dependencies": 0,
23+
"import/no-unresolved": 0,
24+
"import/extensions": 0
25+
}
26+
};

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea/
2+
node_modules/
3+
4+
.DS_Store
5+
*.log
6+
*.log.*

build/dev-server.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const webpack = require('webpack');
2+
const WebpackDevServer = require('webpack-dev-server');
3+
const webpackDevConfig = require('./webpack.config.js');
4+
const open = require('open');
5+
6+
const compiler = webpack(webpackDevConfig);
7+
new WebpackDevServer(compiler, {
8+
contentBase: './',
9+
historyApiFallback: true,
10+
hot: true,
11+
noInfo: false,
12+
publicPath: '/',
13+
stats: { colors: true }
14+
}).listen(3001, (err) => {
15+
console.log('http://127.0.0.1:3001');
16+
console.log('Opening your system browser...');
17+
open('http://127.0.0.1:3001');
18+
});
19+

build/webpack.config.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
const webpack = require('webpack');
2+
const path = require('path');
3+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
4+
const HtmlWebpackPlugin = require('html-webpack-plugin');
5+
6+
const webpackConfig = {
7+
entry: {
8+
app: path.resolve(__dirname, '../src/main.js')
9+
},
10+
output: {
11+
filename: '[name].js',
12+
publicPath: '/'
13+
},
14+
cache: true,
15+
devtool: 'inline-source-map',
16+
resolve: {
17+
extensions: ['.js', '.vue'],
18+
alias: {
19+
vue$: 'vue/dist/vue.esm.js'
20+
}
21+
},
22+
module: {
23+
rules: [
24+
{
25+
test: /\.vue$/,
26+
loader: 'vue-loader',
27+
options: {
28+
extractCSS: true
29+
}
30+
},
31+
{
32+
test: /\.js$/,
33+
use: [
34+
{
35+
loader: 'babel-loader'
36+
}
37+
],
38+
exclude: /node_modules/
39+
},
40+
{
41+
test: /\.(png|jpg|gif|woff|woff2|eot|ttf|svg)$/,
42+
use: ['url-loader?limit=1024&name=images/[name].[hash:8].[ext]']
43+
},
44+
{
45+
test: /\.styl$/,
46+
use: ExtractTextPlugin.extract({
47+
fallback: 'style-loader',
48+
use: [
49+
'css-loader',
50+
'stylus-loader'
51+
]
52+
})
53+
}]
54+
},
55+
plugins: [
56+
new webpack.HotModuleReplacementPlugin(),
57+
new ExtractTextPlugin({
58+
filename: 'styles.[contenthash].css',
59+
disable: false,
60+
allChunks: true
61+
}),
62+
new webpack.NoEmitOnErrorsPlugin(),
63+
new webpack.ProvidePlugin({
64+
$: 'jquery',
65+
jQuery: 'jquery',
66+
'window.jQuery': 'jquery'
67+
}),
68+
new HtmlWebpackPlugin({
69+
filename: 'index.html',
70+
template: path.resolve(__dirname, '../src/index.html'),
71+
inject: true
72+
})
73+
]
74+
};
75+
76+
module.exports = webpackConfig;

package.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "vue-vuex-router-webpack",
3+
"version": "0.0.1",
4+
"description": "",
5+
"main": "main.js",
6+
"dependencies": {},
7+
"scripts": {
8+
"start": "node build/dev-server.js"
9+
},
10+
"keywords": [
11+
"vue",
12+
"vue-router",
13+
"vuex",
14+
"webpack"
15+
],
16+
"author": "July",
17+
"license": "MIT",
18+
"devDependencies": {
19+
"babel-core": "^6.26.0",
20+
"babel-eslint": "^7.2.3",
21+
"babel-loader": "^7.1.2",
22+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
23+
"babel-preset-env": "^1.6.0",
24+
"css-loader": "^0.28.5",
25+
"eslint": "^4.5.0",
26+
"eslint-config-airbnb-base": "^11.3.2",
27+
"eslint-plugin-import": "^2.7.0",
28+
"extract-text-webpack-plugin": "^3.0.0",
29+
"file-loader": "^0.11.2",
30+
"html-webpack-plugin": "^2.30.1",
31+
"open": "0.0.5",
32+
"style-loader": "^0.18.2",
33+
"stylus": "^0.54.5",
34+
"stylus-loader": "^3.0.1",
35+
"url-loader": "^0.5.9",
36+
"vue": "^2.4.2",
37+
"vue-loader": "^13.0.4",
38+
"vue-template-compiler": "^2.4.2",
39+
"webpack": "^3.5.5",
40+
"webpack-dev-server": "^2.7.1"
41+
}
42+
}

src/app.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<div id="app">
3+
<img src="./assets/logo.png">
4+
<hello></hello>
5+
</div>
6+
</template>
7+
8+
<script>
9+
import Hello from './components/Hello';
10+
11+
export default {
12+
name: 'app',
13+
components: {
14+
Hello,
15+
},
16+
};
17+
</script>
18+
19+
<style>
20+
#app {
21+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
22+
-webkit-font-smoothing: antialiased;
23+
-moz-osx-font-smoothing: grayscale;
24+
text-align: center;
25+
color: #2c3e50;
26+
margin-top: 60px;
27+
}
28+
</style>

src/assets/logo.png

6.69 KB
Loading

src/components/Hello.vue

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<template>
2+
<div class="hello">
3+
<h1>{{ msg }}</h1>
4+
<h2>Essential Links</h2>
5+
<ul>
6+
<li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
7+
<li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
8+
<li><a href="https://gitter.im/vuejs/vue" target="_blank">Gitter Chat</a></li>
9+
<li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
10+
<br>
11+
<li><a href="http://vuejs-templates.github.io/webpack/" target="_blank">Docs for This Template</a></li>
12+
</ul>
13+
<h2>Ecosystem</h2>
14+
<ul>
15+
<li><a href="http://router.vuejs.org/" target="_blank">vue-router</a></li>
16+
<li><a href="http://vuex.vuejs.org/" target="_blank">vuex</a></li>
17+
<li><a href="http://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li>
18+
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
19+
</ul>
20+
</div>
21+
</template>
22+
23+
<script>
24+
export default {
25+
name: 'hello',
26+
data() {
27+
return {
28+
msg: 'Welcome to Your Vue.js App',
29+
};
30+
},
31+
};
32+
</script>
33+
34+
<!-- Add "scoped" attribute to limit CSS to this component only -->
35+
<style scoped>
36+
h1, h2 {
37+
font-weight: normal;
38+
}
39+
40+
ul {
41+
list-style-type: none;
42+
padding: 0;
43+
}
44+
45+
li {
46+
display: inline-block;
47+
margin: 0 10px;
48+
}
49+
50+
a {
51+
color: #42b983;
52+
}
53+
</style>

src/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en" id="html">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes"/>
6+
<title>Vue demo</title>
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
</body>
11+
</html>

src/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Vue from 'vue';
2+
import App from './app';
3+
4+
/* eslint-disable no-new */
5+
new Vue({
6+
el: '#app',
7+
template: '<App/>',
8+
components: { App }
9+
});

0 commit comments

Comments
 (0)