Merge branch 'Yukai/#3-vue-setup' into 'frontend-next'

Vue setup

See merge request !2
This commit is contained in:
Yukai Huang 2016-12-26 03:38:07 +00:00
commit 1e276fb37a
9 changed files with 79 additions and 1 deletions

8
.babelrc Normal file
View File

@ -0,0 +1,8 @@
{
"presets": [
"es2015"
],
"plugins": [
"transform-runtime"
]
}

View File

@ -7,6 +7,10 @@ indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
[*.vue]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false

View File

@ -115,6 +115,8 @@
"velocity-animate": "^1.4.0",
"visibilityjs": "^1.2.4",
"viz.js": "^1.4.1",
"vue": "^2.1.6",
"vue-loader": "^10.0.2",
"winston": "^2.3.0",
"xss": "^0.3.2"
},
@ -139,6 +141,12 @@
"url": "https://github.com/hackmdio/hackmd.git"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.21.0",
"babel-loader": "^6.2.10",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.18.0",
"babel-runtime": "^6.20.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.26.1",
"ejs-loader": "^0.3.0",
@ -155,6 +163,7 @@
"script-loader": "^0.7.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"vue-template-compiler": "^2.1.6",
"webpack": "^1.14.0"
}
}

View File

@ -0,0 +1,21 @@
<template>
<h1>{{ message }}</h1>
</template>
<script>
export default {
name: 'HelloWorld',
data() {
return {
message: 'Hello Vue'
}
}
}
</script>
<style scoped>
h1 {
color: blue;
}
</style>

View File

@ -9,6 +9,7 @@ var urlpath = common.urlpath;
var resetCheckAuth = common.resetCheckAuth;
var getLoginState = common.getLoginState;
var clearLoginState = common.clearLoginState;
var loginStateChangeEvent = common.loginStateChangeEvent;
var historyModule = require('./history');
var parseStorageToHistory = historyModule.parseStorageToHistory;
@ -27,6 +28,14 @@ var saveAs = require('file-saver').saveAs;
var List = require('list.js');
var S = require('string');
import Cover from './views/Cover';
import Vue from 'vue';
new Vue({
el: '#cover-app',
render: (h) => h(Cover)
})
var options = {
valueNames: ['id', 'text', 'timestamp', 'fromNow', 'time', 'tags', 'pinned'],
item: '<li class="col-xs-12 col-sm-6 col-md-6 col-lg-4">\

View File

@ -29,6 +29,7 @@ var DROPBOX_APP_KEY = common.DROPBOX_APP_KEY;
var noteurl = common.noteurl;
var checkLoginStateChanged = common.checkLoginStateChanged;
var loginStateChangeEvent = common.loginStateChangeEvent;
var extra = require('./extra');
var md = extra.md;

15
public/js/views/Cover.vue Normal file
View File

@ -0,0 +1,15 @@
<template>
<hello-world />
</template>
<script>
import HelloWorld from '../components/HelloWorld';
export default {
name: 'Cover',
components: {
HelloWorld
}
}
</script>

View File

@ -30,6 +30,7 @@
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<div id="cover-app"></div>
<div class="masthead clearfix">
<div class="inner">

View File

@ -338,7 +338,7 @@ module.exports = {
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules')
],
extensions: ["", ".js"],
extensions: ["", ".js", ".vue"],
alias: {
codemirror: path.join(__dirname, 'node_modules/codemirror/codemirror.min.js'),
inlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/inline-attachment.js'),
@ -372,6 +372,16 @@ module.exports = {
loaders: [{
test: /\.json$/,
loader: 'json-loader'
}, {
test: /\.vue$/,
loader: 'vue',
options: {
// vue-loader options go here
}
}, {
test: /\.js$/,
loader: 'babel',
exclude: [/node_modules/, /public\/vendor/]
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')