If you’re searching for a light-weight JavaScript library similar to jQuery to use in your development for mobile hybrid app (i.e. with PhoneGap) then Zepto is your choice! This library it’s really compact, open source (MIT license), weights just 9.2kB and if you already know jQuery (who doesn’t?) Zepto APIs match jQuery ones…
Zepto’s default package contains these modules: zepto, event, ajax, form and ie (check Zepto site for explanations and full list of modules!).
A very cool thing about Zepto is that you can create your own package with only needed modules! To build a custom Zepto library you should have Node.js installed on your system and follow these steps (for linux and OSX):
- download Zepto source code from Github (i.e. in zip archive)
- unzip it and open a terminal in that directory (i.e. you should be inside something like ‘/tmp/zepto-master/’)
- execute following command:
- npm install
- npm run-script dist
- MODULES=”zepto event data” npm run-script dist
…where “zepto event data” is a space-separated list of wanted modules! After this you should find your Zepto custom library (uncompressed, minified and gzipped) inside ‘dist’ directory (i.e. ‘/tmp/zepto-master/dist/’)…
Please note that inside your custom library you can find in the first line a comment with your choosen modules.