client/build: roll back to underscore
lodash adds extra 50K for no benefit.
This commit is contained in:
parent
98c6128829
commit
94a228b1e7
2 changed files with 6 additions and 6 deletions
|
@ -72,7 +72,7 @@ function minifyHtml(html) {
|
|||
}
|
||||
|
||||
function bundleHtml(config) {
|
||||
const lodash = require('lodash');
|
||||
const underscore = require('underscore');
|
||||
const babelify = require('babelify');
|
||||
const baseHtml = fs.readFileSync('./html/index.htm', 'utf-8');
|
||||
const finalHtml = baseHtml
|
||||
|
@ -83,12 +83,12 @@ function bundleHtml(config) {
|
|||
|
||||
glob('./html/**/*.tpl', {}, (er, files) => {
|
||||
let compiledTemplateJs = '\'use strict\'\n';
|
||||
compiledTemplateJs += 'let _ = require(\'lodash\');';
|
||||
compiledTemplateJs += 'let _ = require(\'underscore\');';
|
||||
compiledTemplateJs += 'let templates = {};';
|
||||
for (const file of files) {
|
||||
const name = path.basename(file, '.tpl').replace(/_/g, '-');
|
||||
const templateText = minifyHtml(fs.readFileSync(file, 'utf-8'));
|
||||
const functionText = lodash.template(
|
||||
const functionText = underscore.template(
|
||||
templateText, {variable: 'ctx'}).source;
|
||||
compiledTemplateJs += `templates['${name}'] = ${functionText};`;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ function bundleCss() {
|
|||
function bundleJs(config) {
|
||||
const browserify = require('browserify');
|
||||
const external = [
|
||||
'lodash',
|
||||
'underscore',
|
||||
'superagent',
|
||||
'mousetrap',
|
||||
'js-cookie',
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
"html-minifier": "^1.3.1",
|
||||
"js-cookie": "^2.1.0",
|
||||
"js-yaml": "^3.5.5",
|
||||
"lodash": "^4.12.0",
|
||||
"merge": "^1.2.0",
|
||||
"mousetrap": "^1.5.3",
|
||||
"nprogress": "^0.2.0",
|
||||
"page": "^1.7.1",
|
||||
"stylus": "^0.54.2",
|
||||
"superagent": "^1.8.3",
|
||||
"uglify-js": "git://github.com/mishoo/UglifyJS2.git#harmony"
|
||||
"uglify-js": "git://github.com/mishoo/UglifyJS2.git#harmony",
|
||||
"underscore": "^1.8.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"watch": "latest"
|
||||
|
|
Loading…
Reference in a new issue