minislides
minislides copied to clipboard
Better compression by using ES6 features
All currently supported browsers are more or less ES6 compatible. So:
- Instead of
function
, use=>
- ~~Replace
.map.call(foo, function(bar){…});
by `for (let bar of foo) {…}``~~ see Chromium bug - Use template string (in case of
'a'+b+'c'
->a${b}c
, not in case of'a'+b
orb+'c'
, since that yields no advantage)
Unfortunately, neither uglifyjs nor esprima/esmangle/escodegen support this. There are four options:
- Wait for estools / uglifyjs to implement that stuff
- Fork and implement the required features
- Use a totally different tool (Some transpiler? Babel Plugin? Traceur?)
- Manually edit the minified result