madrobby / vapor.js

The World's Smallest & Fastest JavaScript Library
http://vaporjs.com
Other
1.37k stars 191 forks source link

vapor.js is too large #67

Open asiekierka opened 11 years ago

asiekierka commented 11 years ago

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?

g105b commented 11 years ago

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.

acicali commented 9 years ago

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.