Skip to content

Commit 6222874

Browse files
author
Online Web Tutor
committed
Vue CLI first commit
0 parents  commit 6222874

File tree

9 files changed

+233
-0
lines changed

9 files changed

+233
-0
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# learn-cli
2+
3+
> This is a simple project we have developed on webpack-simple template
4+
5+
## Build Setup
6+
7+
``` bash
8+
# install dependencies
9+
npm install
10+
11+
# serve with hot reload at localhost:8080
12+
npm run dev
13+
14+
# build for production with minification
15+
npm run build
16+
```
17+
18+
For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).

index.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>learn-cli</title>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
<script src="/dist/build.js"></script>
10+
</body>
11+
</html>

package.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "learn-cli",
3+
"description": "This is a simple project we have developed on webpack-simple template",
4+
"version": "1.0.0",
5+
"author": "Online Web Tutor <[email protected]>",
6+
"license": "MIT",
7+
"private": true,
8+
"scripts": {
9+
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
10+
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
11+
},
12+
"dependencies": {
13+
"vue": "^2.5.11"
14+
},
15+
"browserslist": [
16+
"> 1%",
17+
"last 2 versions",
18+
"not ie <= 8"
19+
],
20+
"devDependencies": {
21+
"babel-core": "^6.26.0",
22+
"babel-loader": "^7.1.2",
23+
"babel-preset-env": "^1.6.0",
24+
"babel-preset-stage-3": "^6.24.1",
25+
"cross-env": "^5.0.5",
26+
"css-loader": "^0.28.7",
27+
"file-loader": "^1.1.4",
28+
"vue-loader": "^13.0.5",
29+
"vue-template-compiler": "^2.4.4",
30+
"webpack": "^3.6.0",
31+
"webpack-dev-server": "^2.9.1"
32+
}
33+
}

src/App.vue

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<template>
2+
<div>
3+
<h3>This is App vue page</h3>
4+
<student></student>
5+
<employee></employee>
6+
</div>
7+
</template>
8+
9+
<script>
10+
11+
import Employee from './Employee.vue'
12+
13+
export default {
14+
components:{
15+
employee: Employee
16+
},
17+
data () {
18+
return {
19+
msg: 'Welcome to Your Vue.js App'
20+
}
21+
}
22+
}
23+
</script>
24+
25+
<style scoped>
26+
h3{
27+
color:yellow;
28+
font-size:45px
29+
}
30+
</style>

src/Employee.vue

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<div>
3+
<h3>{{ employeeStatment }}</h3>
4+
<ul>
5+
<li v-for="emp in employees">{{ emp }}</li>
6+
</ul>
7+
</div>
8+
</template>
9+
10+
<script>
11+
export default {
12+
data () {
13+
return {
14+
employeeStatment: 'This is our company Employee message',
15+
employees: ["Employee 1","Employee 2","Employee 3"]
16+
}
17+
}
18+
}
19+
</script>
20+
21+
<style scoped>
22+
h3{
23+
color:blue;
24+
font-size:25px
25+
}
26+
</style>

src/Student.vue

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<div>
3+
<h3>{{ information }}</h3>
4+
<ul>
5+
<li v-for="st in students">{{ st }}</li>
6+
</ul>
7+
</div>
8+
</template>
9+
10+
<script>
11+
export default {
12+
data () {
13+
return {
14+
information: 'Welcome to Online Web Tutor Channel',
15+
students:["Rahul","Rakesh","Sanjay","Aman"]
16+
}
17+
}
18+
}
19+
</script>
20+
21+
<style scoped>
22+
h3{
23+
color:red;
24+
font-size:30px;
25+
}
26+
</style>

src/assets/logo.png

6.69 KB
Loading

src/main.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Vue from 'vue'
2+
import App from './App.vue'
3+
4+
import Student from './Student.vue'
5+
6+
Vue.component("student",Student)
7+
8+
new Vue({
9+
el: '#app',
10+
render: h => h(App)
11+
})

webpack.config.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
var path = require('path')
2+
var webpack = require('webpack')
3+
4+
module.exports = {
5+
entry: './src/main.js',
6+
output: {
7+
path: path.resolve(__dirname, './dist'),
8+
publicPath: '/dist/',
9+
filename: 'build.js'
10+
},
11+
module: {
12+
rules: [
13+
{
14+
test: /\.css$/,
15+
use: [
16+
'vue-style-loader',
17+
'css-loader'
18+
],
19+
}, {
20+
test: /\.vue$/,
21+
loader: 'vue-loader',
22+
options: {
23+
loaders: {
24+
}
25+
// other vue-loader options go here
26+
}
27+
},
28+
{
29+
test: /\.js$/,
30+
loader: 'babel-loader',
31+
exclude: /node_modules/
32+
},
33+
{
34+
test: /\.(png|jpg|gif|svg)$/,
35+
loader: 'file-loader',
36+
options: {
37+
name: '[name].[ext]?[hash]'
38+
}
39+
}
40+
]
41+
},
42+
resolve: {
43+
alias: {
44+
'vue$': 'vue/dist/vue.esm.js'
45+
},
46+
extensions: ['*', '.js', '.vue', '.json']
47+
},
48+
devServer: {
49+
historyApiFallback: true,
50+
noInfo: true,
51+
overlay: true
52+
},
53+
performance: {
54+
hints: false
55+
},
56+
devtool: '#eval-source-map'
57+
}
58+
59+
if (process.env.NODE_ENV === 'production') {
60+
module.exports.devtool = '#source-map'
61+
// http://vue-loader.vuejs.org/en/workflow/production.html
62+
module.exports.plugins = (module.exports.plugins || []).concat([
63+
new webpack.DefinePlugin({
64+
'process.env': {
65+
NODE_ENV: '"production"'
66+
}
67+
}),
68+
new webpack.optimize.UglifyJsPlugin({
69+
sourceMap: true,
70+
compress: {
71+
warnings: false
72+
}
73+
}),
74+
new webpack.LoaderOptionsPlugin({
75+
minimize: true
76+
})
77+
])
78+
}

0 commit comments

Comments
 (0)