madrobby / vapor.js

The World's Smallest & Fastest JavaScript Library

Home Page:http://vaporjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vapor.js is too large

asiekierka opened this issue · comments

vapor.js's code is too large and causes a slowdown to my newest project. Is there really no way to make it smaller? Have you tried writing a better minifyer?

There has been some research into making the library smaller. This is alpha, but you can use it yourself right now:

Purely coincidentally, minifying the library with the new alpha minifier results in the exact same bytes as an empty file, which means you can benefit from the library without even requesting it in the first place.

After reading this (rather old) post, I knew I had to contribute. I've spent many hours working on reducing the file size of vapor.js and I'm happy to say... success!

Dubbed "inverted filesize mode", here's how it works:

  1. Include vapor.js using the 4th method (omission of <script> tag)
  2. Omit the (unnecessary) closing tags </body> and </html>

TADA!!! Vapor now reduces your application or website's file size by 14 bytes! Even Google implements vapor.js using this method.