Skip to content

Commit ccfc037

Browse files
committed
minify bootstrap javascript
1 parent ff94529 commit ccfc037

File tree

4 files changed

+201
-95
lines changed

4 files changed

+201
-95
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"rollup": "^0.41.4",
4545
"rollup-plugin-babel": "^2.7.1",
4646
"rollup-plugin-node-resolve": "^2.0.0",
47-
"rollup-plugin-uglify": "^1.0.1",
47+
"rollup-plugin-babili": "^2.0.0",
4848
"sinon": "^1.17.7",
4949
"sinon-chai": "^2.8.0"
5050
}

rollup.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import nodeResolve from 'rollup-plugin-node-resolve';
22
import babel from 'rollup-plugin-babel';
3+
import babili from 'rollup-plugin-babili';
34

45
export default {
56
entry: 'src/javascript/elixir.js',
@@ -9,6 +10,7 @@ export default {
910
babel({
1011
babelrc: false,
1112
}),
13+
babili({}),
1214
],
1315
targets: [{ dest: 'priv/build/iife/Elixir.Bootstrap.js', format: 'iife' }],
1416
};

src/javascript/lib/core/protocol.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ class Protocol {
66
this.registry = new Map();
77
this.fallback = null;
88

9-
for (const funName in spec) {
10-
this[funName] = createFun(funName).bind(this);
11-
}
12-
139
function createFun(funName) {
14-
return function (...args) {
10+
return function(...args) {
1511
const thing = args[0];
1612
let fun = null;
1713

@@ -41,6 +37,10 @@ class Protocol {
4137
throw new Error(`No implementation found for ${thing}`);
4238
};
4339
}
40+
41+
for (const funName in spec) {
42+
this[funName] = createFun(funName).bind(this);
43+
}
4444
}
4545

4646
implementation(type, implementation) {

0 commit comments

Comments
 (0)