Skip to content

Commit

Permalink
ready dev-env
Browse files Browse the repository at this point in the history
  • Loading branch information
zzuu666 committed Sep 7, 2017
0 parents commit 666f71d
Show file tree
Hide file tree
Showing 14 changed files with 10,389 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .babelrc
@@ -0,0 +1,14 @@
{
"presets": [
["env", { "modules": false }],
"stage-2"
],
"plugins": ["transform-runtime"],
"comments": false,
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": [ "istanbul" ]
}
}
}
2 changes: 2 additions & 0 deletions .eslintignore
@@ -0,0 +1,2 @@
build/*.js
config/*.js
27 changes: 27 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,27 @@
// http://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
}
}
12 changes: 12 additions & 0 deletions .gitignore
@@ -0,0 +1,12 @@
.DS_Store
node_modules/
dist/
npm-debug.log
yarn-error.log

# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
8 changes: 8 additions & 0 deletions .postcssrc.js
@@ -0,0 +1,8 @@
// https://github.com/michael-ciniawsky/postcss-load-config

module.exports = {
"plugins": {
// to edit target browsers: use "browserlist" field in package.json
"autoprefixer": {}
}
}
73 changes: 73 additions & 0 deletions build/webpack.base.conf.js
@@ -0,0 +1,73 @@
/**
* webpack 鍏叡閰嶇疆
* @author zzuu666
*/

var path = require('path')

function resolve (dir) {
return path.join(__dirname, '..', dir)
}

module.exports = {
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': resolve('src'),
'vue$': 'vue/dist/vue.common.js'
}
},
module: {
rules: [
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('components'), resolve('examples'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter')
}
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loader: {
css: 'vue-style-loader!css-loader',
less: 'vue-style-loader!css-loader!less-loader'
},
postLoaders: {
html: 'babel-loader'
}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('components'), resolve('test')]
},
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
'less-loader'
]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000
}
}
]
}
}
29 changes: 29 additions & 0 deletions build/webpack.dev.config.js
@@ -0,0 +1,29 @@
var path = require('path')
var webpack = require('webpack')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')

module.exports = merge(baseWebpackConfig, {
entry: {
main: './examples/index.js',
vendors: ['vue', 'vue-router']
},
output: {
path: path.join(__dirname, '../examples/dist'),
publicPath: '',
filename: '[name].js',
chunkFilename: '[name].chunk.js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({ name: 'vendors', filename: 'vendor.bundle.js' }),
new HtmlWebpackPlugin({
inject: true,
filename: path.join(__dirname, '../examples/dist/index.html'),
template: path.join(__dirname, '../examples/index.html')
}),
new FriendlyErrorsPlugin()
]
})

Empty file.
22 changes: 22 additions & 0 deletions examples/App.vue
@@ -0,0 +1,22 @@
<template>
<div id="app">
This is ant-design in Vue2.
<router-view></router-view>
</div>
</template>

<script>
export default {
name: 'app'
}
</script>

<style lang="less">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
</style>
11 changes: 11 additions & 0 deletions examples/index.html
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Antd-Vue</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
10 changes: 10 additions & 0 deletions examples/index.js
@@ -0,0 +1,10 @@
import Vue from 'vue'
import App from './App'
import router from './routers'

/* eslint-disable no-new */
new Vue({
el: '#app',
router,
render: h => h(App)
})
11 changes: 11 additions & 0 deletions examples/routers/index.js
@@ -0,0 +1,11 @@
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

let router = new Router({
routes: [
]
})

export default router

0 comments on commit 666f71d

Please sign in to comment.