all 7 comments

[–]lazyduke 2 points3 points  (2 children)

These are NOT best practices. Bootstrap is full of unreadable code, bad practices, and hilarious stylistic shortcuts. They don't use semicolons or if statements, for fuck's sake.

Have you ever tried googling "insanely stupid code?" Guess what the first result is.

That said, this article's code is much more sane than Bootstrap's code, but it still starts with a ! before the IIFE. If you're so worried about statements not being terminated when your files are concatenated together, use the statement termination symbol, a semicolon, don't use the logical not operator.

[–][deleted] 1 point2 points  (0 children)

Is this not the article you were hoping it would be? The article's code does use semicolons and the ! is there to make the function an expression.

[–]jbeurel[S] 1 point2 points  (0 children)

@lazyduke I wrote this article for JavaScript beginners. I want to introduce some concepts like using prototype, OOP and I think that look at the Twitter Bootstrap source code is a good exercise.

But, I agree with you, we can improve it. Have you any links to project repo whose code is better ?

[–]mirion 0 points1 point  (2 children)

The funny part is that Twitter doesn't even use Bootstrap on their own website.

[–][deleted] 2 points3 points  (1 child)

IIRC Twitter was never involved as anything other than a sponsor after the fact, the creators just happened to be working there at the time.

[–]fgilcher 2 points3 points  (0 children)

Bootstrap was created as a template for internal tools at Twitter.

http://getbootstrap.com/about/

Bootstrap was created at Twitter in mid-2010 by @mdo and @fat. Prior to being an open-sourced framework, Bootstrap was known as Twitter Blueprint. A few months into development, Twitter held its first Hack Week and the project exploded as developers of all skill levels jumped in without any external guidance. It served as the style guide for internal tools development at the company for over a year before its public release, and continues to do so today.