Settings

Theme

Show HN: JSMin fork (allows Bootstrap's idiom)

github.com

23 points by palish 14 years ago · 5 comments

Reader

palishOP 14 years ago

Hey all,

Mr. Crockford has recently refused to fix JSMin (https://github.com/twitter/bootstrap/issues/3057).

Thus, I've fixed it. You can get the updated code from https://github.com/shawnpresser/JSMin/blob/master/jsmin.c

The fix was simple. It simply scans for "newline, optional whitespace, exclamation point" and replaces the newline with a semicolon.

I've given special attention to safety. This code works exactly as JSMin did, except it implements the aforementioned semicolon substitution, thus supporting the Javascript idiom:

  a()
  !b && c()
I hope this proves useful to someone (possibly the authors of Bootstrap). It was a fun project.
MrEnigma 14 years ago

Well that discussion is pretty crazy and very polarized.

JSMin guy thinks fixing it is stupid, and the bootstrap guy says that since it works in browsers it should work in JSMin.

So they've reached an impasse. Unfortunately emotions and strong words were used right away which polarizes the conversation.

Being completely pragmatic about it, it seems that bootstrap should probably change, instead of JSMin. But I don't think either will so both sides lose, and potentially make their tools available to a smaller audience.

tszming 14 years ago

Please send a pull request to Crockford :)

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection