4 ms·
I just shaved off another 3 bytes so LoadJS is now 503 bytes (minified + gzipped). HN - If you see a way to get below 500 bytes please let me know! https://git
by andres 10y ago
I just shaved off another 3 bytes so LoadJS is now 503 bytes (minified + gzipped). HN - If you see a way to get below 500 bytes please let me know!
https://github.com/muicss/loadjs/blob/master/src/loadjs.js https://github.com/muicss/loadjs/blob/master/src/loadjs.js
- barsonme 10y agoUsing ES5 features? Because arrow functions would make it smaller. Also using an if/else instead of continue saves 4 bytes. Using arrow functions shaves off another 2 bytes. (Gzipped that's 489 bytes.)[0] [0] - https://closure-compiler.appspot.com/code/jscde34e44897623a837f5b52935589a66f/default.js https://closure-compiler.appspot.com/code/jscde34e44897623a8...
- andres 10y agoThat's a good suggestion but it looks like the minifier removes "continue" automatically: https://raw.githubusercontent.com/muicss/loadjs/master/dist/loadjs.min.js https://raw.githubusercontent.com/muicss/loadjs/master/dist/... Arrow functions would be great but then we'd have to drop support for browsers that don't support ES6.
- barsonme 10y agoIt seems running your original code through the closure compiler shaves it down to 488 max. The closure compiler doesn't respect arrow functions, so I'm assuming that'd have to be changed manually.
- deleted 10y ago[deleted]