Integrated Template loading using html-loader
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"rules": {
|
"rules": {
|
||||||
"indent": [
|
|
||||||
2,
|
|
||||||
4
|
|
||||||
],
|
|
||||||
"linebreak-style": [
|
"linebreak-style": [
|
||||||
2,
|
2,
|
||||||
"unix"
|
"unix"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import $ from 'jquery';
|
|||||||
import Mustache from 'mustache';
|
import Mustache from 'mustache';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import Http from './http';
|
import Http from './http';
|
||||||
|
import template from './views/template.html';
|
||||||
|
|
||||||
export default class MyView extends Backbone.View {
|
export default class MyView extends Backbone.View {
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ export default class MyView extends Backbone.View {
|
|||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
this.el = '#myarea';
|
this.el = '#myarea';
|
||||||
|
console.log(template);
|
||||||
this.$el = $(this.el);
|
this.$el = $(this.el);
|
||||||
this.template = 'Hello';
|
this.template = 'Hello';
|
||||||
Http.service.get('olapa')
|
Http.service.get('olapa')
|
||||||
@@ -28,7 +29,7 @@ export default class MyView extends Backbone.View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
this.$el.html(Mustache.render(this.template));
|
this.$el.html(Mustache.render(template,{data:'This is a sample. sdfhd'}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
src/views/template.html
Normal file
1
src/views/template.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<label for="">LABEL - {{data}}</label>
|
||||||
@@ -10,10 +10,20 @@ module.exports = {
|
|||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
use: 'babel-loader'
|
use: 'babel-loader'
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
test: /\.html$/,
|
||||||
|
use: [{
|
||||||
|
loader: 'html-loader',
|
||||||
|
options: {
|
||||||
|
minimize: true
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: [ './' ],
|
contentBase: ['./'],
|
||||||
watchContentBase: true
|
watchContentBase: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user