Live data from Hacker News

Show HN: Minified.js – a fully-featured, 4K alternative to jQuery and MooTools

minifiedjs.com

31–40 of 145 posts

Re: Show HN: Minified.js – a fully-featured, 4K alternative to jQuery and MooTools

#31
post #30

Earlier quoted context omitted.

Yes, it's extremely common to call jQuery from, for example, Google's googleapis.com domain. Here's a quick sampling from a random group of top sites: stackoverflow.com (googleapis.com), kickstarter.com (googleapis.com), cnn.com (their own cdn), businessinsider.com (jquery.com), foxnews.com (their own cdn), nbcnews.com (aspnetcdn.com), espn.com (espncdn.com), tumblr.com (secure.assets.tumblr.com), lastfm.com (googlea…

Just a passing tinfoil comment... Google has so many fingers in the analytics pie, if you're not being recorded by Adsense or Analytics, then there's always CDN. No idea if it's all linked up, but it means that using alternative search engines doesn't really matter if you still visit Google-enhanced destinations.

Of course it's all linked up, including other freebies such as Google Fonts. Why else would they be offering it for free.

Re: Show HN: Minified.js – a fully-featured, 4K alternative to jQuery and MooTools

#32
Sure, I can switch my code to use this, but how compatible is this with common 3rd party libraries that are dependent on jquery? For example, will this run the bootstrap js code ok? If it doesn't run that code cleanly, then we are still stuck importing jquery.

Re: Show HN: Minified.js – a fully-featured, 4K alternative to jQuery and MooTools

#36
post #8

Earlier quoted context omitted.

What exactly would you miss (other than some utilities like each(), which are I would like to keep out of the library)? Actually one of the ways I used to decide what features to squeeze in was making a list of all jQuery functions and re-implementing the functionality with Minified. To make sure that I don't miss anything important. There are some things that are more complicated to do, because you need to work with…

Sizzle is actually a big one, CSS1 doesn't really cut it for anything but the most trivial use cases, although if you're only targeting modern browsers than I guess you can rely on their support. Also, if you don't support each, I assume you don't support method chaining on enumerables? As for actual missing features, the jQuery data stuff is really useful, but if the intention is to use minified with something like…

My replacement for more advanced CSS features are the methods filter(), sub() and collect(). For example, instead of $('li:odd') you would write $('li').filter(function(v, index) { return index%2;}). But, admittedly, if you are well-versed in those advanced CSS features, they will always be easier to use.

You can chain list methods, as in $('li').filter(function(v, index) { return index%2;}).set({$backgroundColor: '#000'}).animate({$backgroundColor: '#fff'}) to fade every second list element from black to white. The number of collection functions is limited to a minimum though. The Util module will add a lot more collection features (but at a cost of another 4kb).

Yes, that's true, data() is something I intentionally omitted because I don't think that it's worth its bytes today. For simple lower level effects toggle() offers a very different approach of handling state, and for larger apps you should use a MVC framework, as you suggested.

Re: Show HN: Minified.js – a fully-featured, 4K alternative to jQuery and MooTools

#37

Sure, I can switch my code to use this, but how compatible is this with common 3rd party libraries that are dependent on jquery? For example, will this run the bootstrap js code ok? If it doesn't run that code cleanly, then we are still stuck importing jquery.

Not at all. While some things use a similar syntax, Minified is not compatible with jQuery (and does not try to be).

Re: Show HN: Minified.js – a fully-featured, 4K alternative to jQuery and MooTools

#38
post #31
post #30

Earlier quoted context omitted.

Just a passing tinfoil comment... Google has so many fingers in the analytics pie, if you're not being recorded by Adsense or Analytics, then there's always CDN. No idea if it's all linked up, but it means that using alternative search engines doesn't really matter if you still visit Google-enhanced destinations.

Of course it's all linked up, including other freebies such as Google Fonts. Why else would they be offering it for free.

If you're not paying for it then you are the product.

Re: Show HN: Minified.js – a fully-featured, 4K alternative to jQuery and MooTools

#39
post #35

It's nice to see a library use Closure Compiler's advanced compilation mode.

What's funny is that it hardly makes any difference. If you feed the source code into Closure in advanced mode, the size is 9258 bytes pre-gzip and 4109 post-gzip. In simple mode, the numbers are 9267 pre-gzip and ... also 4109 post-gzip! It was hardly worth the (relatively huge) effort to get the library working correctly in advanced mode.

BTW to get down to the final size of 4089, I compress the source code with Closure Compiler in Advanced Mode, and then compress again using UglifyJS to get rid of the last 20 bytes. Closure is not perfect...

Re: Show HN: Minified.js – a fully-featured, 4K alternative to jQuery and MooTools

#40
Thanks for putting this out there. I understand this is supposed to be a swiss-army-knife style library, but I thought we were moving toward focused (Unix philosophy) libraries. For example, why would I use your HTTP request functionality when I could use Superagent, microjax, etc.?
Post reply on HN