aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndrajith K L2017-11-02 16:02:24 +0530
committerIndrajith K L2017-11-02 16:02:24 +0530
commit2249a5f79ff44773f6e1774028861e130d8fe77f (patch)
tree4240b8a12eba69ea2f58844ab500c222b62828aa
parenta7ccf2688f90f28754b8c61fa0b712d6465d2796 (diff)
downloades6-backbone-2249a5f79ff44773f6e1774028861e130d8fe77f.tar.gz
es6-backbone-2249a5f79ff44773f6e1774028861e130d8fe77f.tar.bz2
es6-backbone-2249a5f79ff44773f6e1774028861e130d8fe77f.zip
Integrated Template loading using html-loader
-rw-r--r--.eslintrc5
-rw-r--r--src/myview.js5
-rw-r--r--src/views/template.html1
-rw-r--r--webpack.config.js26
4 files changed, 23 insertions, 14 deletions
diff --git a/.eslintrc b/.eslintrc
index 4a9168b..be4e71c 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,10 +1,7 @@
{
"rules": {
- "indent": [
- 2,
- 4
- ],
+
"linebreak-style": [
2,
"unix"
diff --git a/src/myview.js b/src/myview.js
index d5c0484..a7e9c23 100644
--- a/src/myview.js
+++ b/src/myview.js
@@ -4,7 +4,7 @@ import $ from 'jquery';
import Mustache from 'mustache';
import axios from 'axios';
import Http from './http';
-
+import template from './views/template.html';
export default class MyView extends Backbone.View {
@@ -14,6 +14,7 @@ export default class MyView extends Backbone.View {
initialize() {
this.el = '#myarea';
+ console.log(template);
this.$el = $(this.el);
this.template = 'Hello';
Http.service.get('olapa')
@@ -28,7 +29,7 @@ export default class MyView extends Backbone.View {
}
render() {
- this.$el.html(Mustache.render(this.template));
+ this.$el.html(Mustache.render(template,{data:'This is a sample. sdfhd'}));
}
diff --git a/src/views/template.html b/src/views/template.html
new file mode 100644
index 0000000..fe73372
--- /dev/null
+++ b/src/views/template.html
@@ -0,0 +1 @@
+<label for="">LABEL - {{data}}</label>
diff --git a/webpack.config.js b/webpack.config.js
index a251411..e6ed2ee 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -7,13 +7,23 @@ module.exports = {
},
module: {
rules: [{
- test: /\.js$/,
- exclude: /node_modules/,
- use: 'babel-loader'
- }]
+ test: /\.js$/,
+ exclude: /node_modules/,
+ use: 'babel-loader'
+ },
+ {
+ test: /\.html$/,
+ use: [{
+ loader: 'html-loader',
+ options: {
+ minimize: true
+ }
+ }],
+ }
+ ]
},
- devServer: {
- contentBase: [ './' ],
- watchContentBase: true
- }
+ devServer: {
+ contentBase: ['./'],
+ watchContentBase: true
+ }
};