WordPress.com Admin now in JavaScript

The WordPress.com development team has now moved development of the WordPress.com CMS admin to JavaScript.
Two articles to read:

Given the pervasiveness of WordPress and the size of the development community, I believe this is a watershed moment. Arguably web developers are now officially living in a JavaScript-driven world. Might this be the beginning of the end for PHP?

This chart of benefits from the WP developer article says it all. (Click to expand.)
WordPress.com advantages of new workflow
See this table listing the benefits of the new JavaScript workflow at WordPress.com.

Build a Faster HTML5 App with Backbone.js, Zepto.js and Trigger.io

This post from Trigger.io shares a strategy for creating Android and iOS apps from a single HTML5 codebase.

The post walks through:

  • including your JavaScript files
  • using Backbone.js to present a responsive interface
  • using the HTML5 boilerplate to reduce inconsistencies across platforms

Read it here: How to build fast HTML5 mobile apps using backbone.js, zepto.js and trigger.io – Cross Platform Dev Blog

CoffeeScript: A Roundup for Beginners

CoffeeScript Logo

CoffeeScript brings new elegance and efficiency to the writing of JavaScript. It helpfully enforces JavaScript best practices. And it compiles into highly performant JSLint compliant code. The golden rule of CoffeeScript is: “It’s just JavaScript”.

Home Base


Introductory Overviews

Perspectives on CoffeeScript

CoffeeScript Basics: Introductory Articles and Tuts

CoffeeScripter’s Toolkit

  • js2Coffee.org — quickly convert JavaScript to CoffeeScript, and vice versa
  • CoffeeScript Cookbook — online recipes — “CoffeeScript recipes for the community by the community.”

CoffeeScript Books

What is this list missing?

This is a live list. Please post additional recommendations below!

Related Posts

CoffeeScript Intro Video by Sam Stephenson of 37signals

Sam Stephenson, of 37signals and Prototype.js, gives a 45-minute introductory walk through CoffeeScript, it’s uses and benefits, at the Future of Web Apps London, 2011.

Telling Screenshots from the Presentation

Check out these CoffeeScript / JavaScript side-by-side comparisons. The screenshots are not high resolution, but you can get the idea. When possible, I’ve included where these appeared in the presentation.

CoffeeScript Switch Statement (25:03 – 25:50)

Better JS with CoffeeScript Screenshot

Classes and Inheritance — CoffeeScript (29:34)

Better JS with CoffeeScript Screenshot

Comparable inheritance code in JavaScript!

Better JS with CoffeeScript Screenshot

Comprehensions (27:20 – 27:50)

in CoffeeScript

comparable code in JavaScript
Better JS with CoffeeScript Screenshot

Destructuring: Person, Name Split in CoffeeScript (37:30 – 38:20)

Better JS with CoffeeScript Screenshot

Multiline Strings in CoffeeScript (39:23)

Better JS with CoffeeScript Screenshot

Notes from the Presentation

Random Highlights

  • “The golden rule of CoffeeScript is: ‘It’s just JavaScript.'” (12:57-13:22)
  • “All of the crap” (extraneous braces and semicolons) “just fades away.” (13:30-13:40)
  • “JavaScript gives you so many ways to shoot yourself in the foot, but there is a golden path…. and CoffeeScript forces you to use it.” (13:40-14:50)
  • “I see what I’m actually doing. Code looks clearer.”  (21:00 – 22:44)
  • Compiles to code that is optimized for performance, without reliance upon libraries (27:50-59)
  • “Completely lowers the barrier to writing fast, good code.” (28:00 – 28:16)

How CoffeeScript Enforces JavaScript’s Good Parts

For those familiar with Douglas Crockford’s JavaScript: The Good Parts, Stephenson highlights how CoffeeScript pushes you in that direction:

  1. It’s private by default. Each file compiles into a self-executing closure. No leaking of global variables. (14:50 – 16:00)
  2. No more “var” keyword. Enforces lexical scope. (16:00 – 17:06)
  3. Strict comparisons. No more “==” vs. “===” confusion. CoffeeScript’s “is” keyword is always “===”. (17:07 – 18:05)
  4. Runs anywhere. JSLint compliant. (18:06 – 18:40)

10 Best Features of CoffeeScript

Beginning at 18:40, Stephenson walks through 10 of his favorite features of CoffeeScript, with lots of practical coding examples.

Here is a brief summary of his 10 points:

  1. Functions syntax (18:40 – 20:35) — greatly simplified, with much less typing
  2. Significant white space (20:36 – 22:44) — indentation and line breaks replace braces, semicolons. Stephenson: “I see what I’m actually doing. Code looks clearer.”
  3. Bare objects syntax (22:45 – 24:25) — makes for much greater coding efficiency
  4. Everything’s an expression (24:36 – 25:50) — “Everything has a value.”
  5. Comprehensions (25:51 – 28:19) — each, map, select made simple — and compiles to fast, good code
  6. Classes and Inheritance (28:20 – 31:24) — “CoffeeScript makes it incredibly simple and terse to write classes.”
  7. Bound functions (31:25 – 34:39) — the fat arrow => binds a function definition to its current scope, and can also be used to define instance methods
  8. Conditionals (34:40 – 37:10) — greatly simplifies the writing of conditionals
    • allows you to put a conditional at the end of an expression
    • introduces the “unless” keyword
    • introduces the existential operator : “?” at the end of a line checks to see if a value is undefined or null
    • also the soak operator
  9. Destructuring Assignment (37:11 – 38:06) — a proposal for the next version of JavaScript, already available in CoffeeScript
  10. String Syntax (38:07 – 39:39) —
    • does not require string concatenation
    • enables writing of multi-line strings (with indentation) between triple-quotes

How to Use CoffeeScript

Stephenson ends with a few notes regarding ways to incorporate CoffeeScript into your development workflow. (39:40 – 43:34)

  • CoffeeScript.org includes a tool that shows you exactly how a line of CoffeeScript compiles to JS
  • Compiling via command line
  • Compiling on the fly
  • Rails 3.1 Sprockets — automatically compiles CoffeeScript on the fly
    • 37signals currently uses this to use CoffeeScript everywhere
  • Node.js – Stitch project

Related Posts

Comparing Scripts in jQuery and JavaScript: A Comparison by Jeffrey Way

In a recent post, From jQuery to JavaScript: A Reference, Jeffrey Way gives an excellent run-down of how to get scripty things done in three idioms: jQuery, current JavaScript, and legacy JavaScript.

It’s an outstanding read.

Item number one gives a great introduction to JavaScript’s new Selectors API, which approximates jQuery for its ability to query the DOM in CSS-selector style.

So for instance, compare these three ways of doing things:

Selecting Elements




var container = document.querySelector('#container');

Legacy JavaScript

var container = document.getElementById('container');

Or consider this:

Add, Remove, and Toggle Classes




var container = document.querySelector('#box');

Legacy JavaScript

var box = document.getElementById('box'),
    hasClass = function (el, cl) {
        var regex = new RegExp('(?:s|^)' + cl + '(?:s|$)');
        return !!el.className.match(regex);
    addClass = function (el, cl) {
        el.className += ' ' + cl;
    removeClass = function (el, cl) {
        var regex = new RegExp('(?:s|^)' + cl + '(?:s|$)');
        el.className = el.className.replace(regex, ' ');
    toggleClass = function (el, cl) {
        hasClass(el, cl) ? removeClass(el, cl) : addClass(el, cl);
addClass(box, 'drago');
removeClass(box, 'drago');
toggleClass(box, 'drago'); // if the element does not have a class of 'drago', add one.

Credit: These examples are from the post, From jQuery to JavaScript: A Reference, by Jeffrey Way.

Which is better? — or Which is better When?

As Way points out, the question is not necessarily “Which is better?” but “Which is better when?” JavaScript’s new Selector API goes a long way toward making vanilla JavaScript nearly as easy to work with as jQuery. In cases where we can get things done without loading the jQuery library, our sites will travel lighter and perform a bit snappier.

They take-away: The jQuery library is fantastic when you need it, but in each case, we should pause to ask: “Do I really need jQuery in this case? — Or can I get it done in straight JavaScript?”


Backbone.js: A Roundup for Beginners

Backbone.js LogoBringing MVC architecture to the creation of Web applications, Backbone.js helps you manage complexity while keep your coding practices clean, including maintaining a neat separation of content from presentation. Backbone.js plays well with other libraries, giving developers freedom to follow their own preferences for DOM scripting — whether with jQuery, Dojo, Prototype, etc.

Developed by Jeremy Ashkenas, creator of CoffeeScript, Backbone.js has quickly built an active and helpful community of developers. If you’d like to start learning more about it, here are some excellent places to start.

Home Base

Backbone.js lives here


Resource Roundups

Leading Competitors

Related Posts

A Case for Sproutcore over Backbone.js for Web Apps

Sproutcore Logo

@mfied makes an interesting case for utilizing Sproutcore for web app development.

Read the Post

Via Building interactive web apps with SproutCore | Minified:

Currently, Backbone gets a lot of the attention, and rightly so, it’s a great framework. In this post though, I want to demonstrate a use case where I believe SproutCore 2 excels — building interactive web apps.

Developing in SproutCore takes away the need to update and re-render views, and the focus shifts entirely to managing and updating the client side data model.

Go read the post


Conditional Loading for Responsive Designs — 24 ways

For you responsive web designers: excellent post from 24 ways, by Jeremy Keith —

Need to keep your site friendly for mobile devices, and yet load rich content for devices that can handle it? Employ an if statement in your script.

Very simple to implement. Excellent how to and demo included.

“If I only want to run that search when there’s room for a sidebar, I can wrap it in an if statement.”

Conditional Loading Snippet

“If the browser is wider than 640 pixels, that will fire off a search for news stories about cats and put the results into the newsresults element in my markup.”

24 ways: Conditional Loading for Responsive Designs