Skip to content

Commit

Permalink
temp: Integrate VueJS 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyip committed Jan 25, 2017
1 parent 747f66b commit 97cf122
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"jquery-validation": "1.15.1",
"plotly.js": "1.19.2",
"webpack": "1.12.2",
"zxcvbn": "4.4.1"
"zxcvbn": "4.4.1",
"vue": "2.1.10"
},
"devDependencies": {
"casperjs": "1.1.3",
Expand All @@ -27,7 +28,12 @@
"nwmatcher": "1.3.6",
"phantomjs-prebuilt": "2.1.14",
"webpack-dev-server": "1.12.1",
"xmlhttprequest": "1.5.0"
"xmlhttprequest": "1.5.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"vue-loader": "^10.0.0",
"vue-template-compiler": "^2.1.0"
},
"scripts": {
"lint": "eslint --quiet",
Expand Down
14 changes: 14 additions & 0 deletions static/js/components/sidebar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<div>
{{ msg }}
</div>
</template>

<script>
module.exports = {
name: 'sidebar',
data: function () {
msg: 'Testing string from Vue.js'
}
}
</script>
7 changes: 7 additions & 0 deletions static/js/src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// commonjs code goes here
var Vue = require('vue');
var sidebar = require('../components/sidebar.vue');

(function () {
var i18n = window.i18n = require('i18next');
Expand Down Expand Up @@ -52,4 +54,9 @@
}
};

new Vue({
el: '#sidebar',
render: function(h) { h(sidebar); }
});

}());
1 change: 1 addition & 0 deletions templates/zerver/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ <h3>{{ _('Loading...') }}</h3>
</div>
</div>

<div id="sidebar"></div>
<div class="app">
<div class="app-main">
<div class="column-left">
Expand Down
17 changes: 17 additions & 0 deletions tools/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var webpack = require('webpack')

module.exports = {
entry: [
'webpack-dev-server/client?http://0.0.0.0:9991/socket.io',
Expand All @@ -17,4 +19,19 @@ module.exports = {
poll: 1000,
},
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
}
};

0 comments on commit 97cf122

Please sign in to comment.