
committed by
GitHub

No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 5476 additions and 268 deletions
-
35README.md
-
8meta.json
-
7template/.babelrc
-
9template/.editorconfig
-
6template/.gitignore
-
20template/README.md
-
19template/index.html
-
52template/package.json
-
70template/src/App.vue
-
BINtemplate/src/assets/logo.png
-
22template/src/main.js
-
3template/src/pages/index.vue
-
3template/src/pages/test.vue
-
13template/src/route.config.js
-
60template/webpack.base.conf.js
-
111template/webpack.config.js
-
33template/webpack.dev.conf.js
-
5273template/yarn.lock
@ -1,33 +1,2 @@ |
|||
# webpack-simple |
|||
|
|||
> A simple Vue 2.0 Webpack & `vue-loader` setup for quick prototyping. Note this template is not suitable for production - for that you may want to use the [full webpack template](https://github.com/vuejs-templates/webpack). |
|||
|
|||
> This template is Vue 2.0 compatible. For Vue 1.x use this command: `vue init webpack-simple#1.0 my-project` |
|||
|
|||
### Usage |
|||
|
|||
This is a project template for [vue-cli](https://github.com/vuejs/vue-cli). |
|||
|
|||
``` bash |
|||
$ npm install -g vue-cli |
|||
$ vue init webpack-simple my-project |
|||
$ cd my-project |
|||
$ npm install |
|||
$ npm run dev |
|||
``` |
|||
|
|||
### What's Included |
|||
|
|||
- `npm run dev`: Webpack + `vue-loader` with proper config for source maps & hot-reload. |
|||
|
|||
- `npm run build`: build with HTML/CSS/JS minification. |
|||
|
|||
For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader). Also check out the [breaking changes in vue-loader@9.0.0](https://github.com/vuejs/vue-loader/releases/tag/v9.0.0). |
|||
|
|||
### Fork It And Make Your Own |
|||
|
|||
You can fork this repo to create your own boilerplate, and use it with `vue-cli`: |
|||
|
|||
``` bash |
|||
vue init username/repo my-project |
|||
``` |
|||
# lantern-simple-template |
|||
lantern模版 |
@ -1,6 +1,3 @@ |
|||
{ |
|||
"presets": [ |
|||
["env", { "modules": false }], |
|||
"stage-3" |
|||
] |
|||
} |
|||
"presets": ["es2015", "stage-3"] |
|||
} |
@ -1,9 +0,0 @@ |
|||
root = true |
|||
|
|||
[*] |
|||
charset = utf-8 |
|||
indent_style = space |
|||
indent_size = 2 |
|||
end_of_line = lf |
|||
insert_final_newline = true |
|||
trim_trailing_whitespace = true |
@ -1,12 +1,12 @@ |
|||
node_modules |
|||
.DS_Store |
|||
node_modules/ |
|||
dist/ |
|||
npm-debug.log |
|||
yarn-error.log |
|||
|
|||
# Editor directories and files |
|||
.idea |
|||
.vscode |
|||
*.suo |
|||
*.ntvs* |
|||
*.njsproj |
|||
*.sln |
|||
*.sln |
@ -1,18 +1,2 @@ |
|||
# {{ name }} |
|||
|
|||
> {{ description }} |
|||
|
|||
## Build Setup |
|||
|
|||
``` bash |
|||
# install dependencies |
|||
npm install |
|||
|
|||
# serve with hot reload at localhost:8080 |
|||
npm run dev |
|||
|
|||
# build for production with minification |
|||
npm run build |
|||
``` |
|||
|
|||
For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader). |
|||
# lantern-simple-template |
|||
lantern模版 |
@ -1,11 +1,10 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>{{ name }}</title> |
|||
</head> |
|||
<body> |
|||
<div id="app"></div> |
|||
<script src="/dist/build.js"></script> |
|||
</body> |
|||
</html> |
|||
<html lang="zh-CN"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<title>lantern</title> |
|||
</head> |
|||
<body> |
|||
<div id="app"></div> |
|||
</body> |
|||
</html> |
@ -1,37 +1,35 @@ |
|||
{ |
|||
"name": "{{ name }}", |
|||
"description": "{{ description }}", |
|||
"name": "lantern-template", |
|||
"version": "1.0.0", |
|||
"author": "{{ author }}", |
|||
"license": "{{ license }}", |
|||
"private": true, |
|||
"description": "lantern模版", |
|||
"main": "index.js", |
|||
"scripts": { |
|||
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", |
|||
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules" |
|||
"tempinit": "yarn || npm install", |
|||
"dev": "cross-env webpack-dev-server --open --hot --inline --host --port 8010 --config ./build/webpack.dev.conf.js" |
|||
}, |
|||
"dependencies": { |
|||
"vue": "^2.5.11" |
|||
}, |
|||
"browserslist": [ |
|||
"> 1%", |
|||
"last 2 versions", |
|||
"not ie <= 8" |
|||
], |
|||
"license": "MIT", |
|||
"devDependencies": { |
|||
"babel-core": "^6.26.0", |
|||
"babel-loader": "^7.1.2", |
|||
"babel-preset-env": "^1.6.0", |
|||
"babel-preset-es2015": "^6.24.1", |
|||
"babel-preset-stage-3": "^6.24.1", |
|||
"cross-env": "^5.0.5", |
|||
"css-loader": "^0.28.7", |
|||
"file-loader": "^1.1.4", |
|||
{{#sass}} |
|||
"node-sass": "^4.5.3", |
|||
"sass-loader": "^6.0.6", |
|||
{{/sass}} |
|||
"vue-loader": "^13.0.5", |
|||
"vue-template-compiler": "^2.4.4", |
|||
"webpack": "^3.6.0", |
|||
"webpack-dev-server": "^2.9.1" |
|||
"cross-env": "^5.1.3", |
|||
"css-loader": "^0.28.9", |
|||
"extract-text-webpack-plugin": "^3.0.2", |
|||
"html-webpack-plugin": "^2.30.1", |
|||
"less": "^2.7.3", |
|||
"less-loader": "^4.0.5", |
|||
"style-loader": "^0.20.2", |
|||
"vue-loader": "^13.7.0", |
|||
"vue-style-loader": "^3.0.3", |
|||
"vue-template-compiler": "^2.5.13", |
|||
"webpack": "^3.10.0", |
|||
"webpack-dev-server": "^2.11.0", |
|||
"webpack-merge": "^4.1.1" |
|||
}, |
|||
"dependencies": { |
|||
"lantern-ui": "^0.9.21", |
|||
"vue": "^2.5.13", |
|||
"vue-router": "^3.0.1" |
|||
} |
|||
} |
Before Width: 200 | Height: 200 | Size: 6.7 KiB |
@ -1,7 +1,21 @@ |
|||
import Vue from 'vue' |
|||
import App from './App.vue' |
|||
import Vue from 'vue'; |
|||
import App from './app.vue'; |
|||
import VueRouter from 'vue-router'; |
|||
import Lantern from 'lantern-ui'; |
|||
import routes from './route.config.js'; |
|||
import 'lantern-ui/lib/lantern.css'; |
|||
|
|||
Vue.use(VueRouter); |
|||
const router = new VueRouter({ |
|||
mode: 'history', |
|||
base: __dirname, |
|||
routes: routes |
|||
}) |
|||
|
|||
Vue.use(Lantern); |
|||
|
|||
new Vue({ |
|||
el: '#app', |
|||
render: h => h(App) |
|||
}) |
|||
render: h => h(App), |
|||
router: router |
|||
}); |
@ -0,0 +1,3 @@ |
|||
<template> |
|||
<div>index page</div> |
|||
</template> |
@ -0,0 +1,3 @@ |
|||
<template> |
|||
<div>test page</div> |
|||
</template> |
@ -0,0 +1,13 @@ |
|||
import index from './pages/index.vue'; |
|||
import test from './pages/test.vue'; |
|||
|
|||
export default [ |
|||
{ |
|||
path: '/', |
|||
component: index |
|||
}, |
|||
{ |
|||
path: '/test', |
|||
component: test |
|||
} |
|||
] |
@ -0,0 +1,60 @@ |
|||
const path = require('path'); |
|||
const ExtractTextPlugin = require("extract-text-webpack-plugin") |
|||
|
|||
function resolve(dir) { |
|||
return path.join(__dirname, '..', dir); |
|||
} |
|||
|
|||
const baseConfig = { |
|||
resolve: { |
|||
alias: { |
|||
'vue$': 'vue/dist/vue.esm.js', |
|||
'src': resolve('/src') |
|||
} |
|||
}, |
|||
module: { |
|||
rules: [ |
|||
{ |
|||
test: /\.vue$/, |
|||
use: { |
|||
loader: 'vue-loader', |
|||
options: { |
|||
loaders: { |
|||
css: ExtractTextPlugin.extract({ |
|||
use: 'css-loader', |
|||
fallback: 'vue-style-loader' |
|||
}), |
|||
less: ExtractTextPlugin.extract({ |
|||
use: ['css-loader', 'less-loader'], |
|||
fallback: 'vue-style-loader' |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
test: /\.js$/, |
|||
use: 'babel-loader', |
|||
exclude: /node_modules/ |
|||
}, |
|||
{ |
|||
test: /\.(png|jpg|gif|svg|ttf)$/, |
|||
use: { |
|||
loader: 'file-loader', |
|||
options: { |
|||
name: '[name].[ext]?[hash]' |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
test: /\.css$/, |
|||
use: ExtractTextPlugin.extract({ |
|||
use: 'css-loader', |
|||
fallback: 'style-loader' |
|||
}) |
|||
} |
|||
] |
|||
}, |
|||
} |
|||
|
|||
module.exports = baseConfig; |
@ -1,111 +0,0 @@ |
|||
var path = require('path') |
|||
var webpack = require('webpack') |
|||
|
|||
module.exports = { |
|||
entry: './src/main.js', |
|||
output: { |
|||
path: path.resolve(__dirname, './dist'), |
|||
publicPath: '/dist/', |
|||
filename: 'build.js' |
|||
}, |
|||
module: { |
|||
rules: [ |
|||
{ |
|||
test: /\.css$/, |
|||
use: [ |
|||
'vue-style-loader', |
|||
'css-loader' |
|||
], |
|||
},{{#sass}} |
|||
{ |
|||
test: /\.scss$/, |
|||
use: [ |
|||
'vue-style-loader', |
|||
'css-loader', |
|||
'sass-loader' |
|||
], |
|||
}, |
|||
{ |
|||
test: /\.sass$/, |
|||
use: [ |
|||
'vue-style-loader', |
|||
'css-loader', |
|||
'sass-loader?indentedSyntax' |
|||
], |
|||
}, |
|||
{{/sass}} |
|||
{ |
|||
test: /\.vue$/, |
|||
loader: 'vue-loader', |
|||
options: { |
|||
loaders: { |
|||
{{#sass}} |
|||
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
|
|||
// the "scss" and "sass" values for the lang attribute to the right configs here.
|
|||
// other preprocessors should work out of the box, no loader config like this necessary.
|
|||
'scss': [ |
|||
'vue-style-loader', |
|||
'css-loader', |
|||
'sass-loader' |
|||
], |
|||
'sass': [ |
|||
'vue-style-loader', |
|||
'css-loader', |
|||
'sass-loader?indentedSyntax' |
|||
] |
|||
{{/sass}} |
|||
} |
|||
// other vue-loader options go here
|
|||
} |
|||
}, |
|||
{ |
|||
test: /\.js$/, |
|||
loader: 'babel-loader', |
|||
exclude: /node_modules/ |
|||
}, |
|||
{ |
|||
test: /\.(png|jpg|gif|svg)$/, |
|||
loader: 'file-loader', |
|||
options: { |
|||
name: '[name].[ext]?[hash]' |
|||
} |
|||
} |
|||
] |
|||
}, |
|||
resolve: { |
|||
alias: { |
|||
'vue$': 'vue/dist/vue.esm.js' |
|||
}, |
|||
extensions: ['*', '.js', '.vue', '.json'] |
|||
}, |
|||
devServer: { |
|||
historyApiFallback: true, |
|||
noInfo: true, |
|||
overlay: true |
|||
}, |
|||
performance: { |
|||
hints: false |
|||
}, |
|||
devtool: '#eval-source-map' |
|||
} |
|||
|
|||
if (process.env.NODE_ENV === 'production') { |
|||
module.exports.devtool = '#source-map' |
|||
// http://vue-loader.vuejs.org/en/workflow/production.html
|
|||
module.exports.plugins = (module.exports.plugins || []).concat([ |
|||
new webpack.DefinePlugin({ |
|||
'process.env': { |
|||
NODE_ENV: '"production"' |
|||
} |
|||
}), |
|||
new webpack.optimize.UglifyJsPlugin({ |
|||
sourceMap: true, |
|||
compress: { |
|||
warnings: false |
|||
} |
|||
}), |
|||
new webpack.LoaderOptionsPlugin({ |
|||
minimize: true |
|||
}) |
|||
]) |
|||
} |
@ -0,0 +1,33 @@ |
|||
const path = require('path'); |
|||
const webpack = require('webpack'); |
|||
const webpackMerge = require('webpack-merge'); |
|||
const webpackbaseConf = require('./webpack.base.conf.js'); |
|||
const HtmlWebpackPlugin = require('html-webpack-plugin'); |
|||
const ExtractTextPlugin = require("extract-text-webpack-plugin"); |
|||
|
|||
const devConfig = { |
|||
entry: { |
|||
main: './src/main.js', |
|||
vendors: ['vue', 'vue-router'] |
|||
}, |
|||
output: { |
|||
path: path.join(__dirname, './dist'), |
|||
filename: '[name].js', |
|||
publicPath: '', |
|||
chunkFilename: '[name].chunk.js' |
|||
}, |
|||
plugins: [ |
|||
new HtmlWebpackPlugin({ |
|||
template: './src/index.html' |
|||
}), |
|||
new ExtractTextPlugin("style.css") |
|||
], |
|||
devServer: { |
|||
historyApiFallback: true, |
|||
noInfo: true, |
|||
overlay: true, |
|||
public: 'localhost:8010' |
|||
} |
|||
} |
|||
|
|||
module.exports = webpackMerge(webpackbaseConf, devConfig); |
5273
template/yarn.lock
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue