Authored by 黄涛

add webpack

... ... @@ -37,9 +37,10 @@
"connect-memcached": "^0.2.0",
"cookie-parser": "^1.4.3",
"express": "^4.13.1",
"handlebars": "^4.0.5",
"express-handlebars": "^3.0.0",
"express-session": "^1.13.0",
"handlebars": "^4.0.5",
"handlebars-loader": "^1.4.0",
"influxdb-winston": "^1.0.1",
"lodash": "^4.13.1",
"md5": "^2.1.0",
... ...
... ... @@ -4,11 +4,11 @@
<div class="coupon-big-list">
{{#newList}}
{{> product/coupon-big-item}}
{{>coupon-big-item}}
{{/newList}}
{{#oldList}}
{{> product/coupon-big-item}}
{{>coupon-big-item}}
{{/oldList}}
</div>
</div>
... ...
/**
* Created by TaoHuang on 2016/10/26.
*/
'use strict';
exports.if_cond = (left, operator, right, options) => {
switch (operator) {
case '==':
return (left == right) ? options.fn(this) : options.inverse(this); // eslint-disable-line
case '===':
return (left === right) ? options.fn(this) : options.inverse(this);
case '<':
return (left < right) ? options.fn(this) : options.inverse(this);
case '<=':
return (left <= right) ? options.fn(this) : options.inverse(this);
case '>':
return (left > right) ? options.fn(this) : options.inverse(this);
case '>=':
return (left >= right) ? options.fn(this) : options.inverse(this);
case '&&':
return (left && right) ? options.fn(this) : options.inverse(this);
case '||':
return (left || right) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
};
... ...
... ... @@ -31,28 +31,9 @@ var colTxt = {
var $saleReturn = $('#saleReturn');
Handlebars.registerHelper('if_cond', function(left, operator, right, options) {
switch (operator) {
case '==':
return (left == right) ? options.fn(this) : options.inverse(this); // eslint-disable-line
case '===':
return (left === right) ? options.fn(this) : options.inverse(this);
case '<':
return (left < right) ? options.fn(this) : options.inverse(this);
case '<=':
return (left <= right) ? options.fn(this) : options.inverse(this);
case '>':
return (left > right) ? options.fn(this) : options.inverse(this);
case '>=':
return (left >= right) ? options.fn(this) : options.inverse(this);
case '&&':
return (left && right) ? options.fn(this) : options.inverse(this);
case '||':
return (left || right) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
});
var tpl = require('coupon-big-list.hbs');
tpl({a:1,b:2});
bindEvent.add(function() {
var $imgShow = $('#img-show'),
... ...
... ... @@ -35,6 +35,24 @@ module.exports = {
path: path.join(__dirname, 'bundle'), // absolute path
filename: '[name].js'
},
module: {
loaders: [{
test: /\.hbs$/,
loader: 'handlebars-loader',
query: {
helperDirs: [
path.join(__dirname, '/js/common/helpers')
]
}
}]
},
resolves: {
modulesDirectories: ['node_modules','./hbs', './scss', './js'],
alias :{
js: path.join(__dirname, 'js/'),
hbs: path.join(__dirname,'hbs/')
}
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.CommonsChunkPlugin({
... ...