Tag Archives: JavaScript

Blog post on Bocoup.com: Using NPM script aliases as a tooling facade

I recently contributed an article entitled A Facade for Tooling with NPM Scripts to the Bocoup blog. Package.json script aliases let your project take advantage of npm-based tooling without the need for globally-installed packages, and can provide a common interface for handling package or application build tasks independent from the technology underlying those tasks.

Package scripts expose important tasks in a consistent, discoverable way. Lowering the barrier to entry means faster ramp-up for new employees, easier contributor onboarding, and less delay if you revisit a codebase after leaving it for a long period of time. There’s no downside to adding package scripts—at worst they just alias through to other tools—and there’s a lot to be gained! (read more)

This technique’s been a big help to myself and my team, and I hope you’ll give the article a read and let me know your thoughts.

Side Projects talk from EmpireJS

I had the pleasure of speaking in New York this month at EmpireJS, and the video of my talk has been uploaded I discuss why side projects are important to our learning & growth as developers, and offer some ways that we can integrate this type of exploration into our work so that our “side” projects needn’t be so peripheral to the rest of our jobs. It’s a topic I care about deeply, and I’m thrilled to have had the opportunity to share it with such a great audience—thank you to everybody at EmpireJS for the warm reception you gave me!

Slides from the talk are here. Press “s” to pop up the speaker notes view, if you’re interested in additional context!

Enhanced Twenty Fourteen Image Navigation

In my JS Unit Testing presentation today for WPSessions (slides for the talk are available here), I showed a WordPress plugin I’ve written which is designed to improve the keyboard image navigation experience within the Twenty Fourteen theme. In that theme it’s possible to use the left and right arrow keys while browsing images to navigate to the previous or next image, but doing so triggers a full page refresh each time.

Since I needed to write some code anyway in order to demonstrate the use of QUnit with a WordPress plugin, I went ahead and wrote a small plugin that will replace the default Twenty Fourteen image navigation script with one that fetches the requested image via jQuery’s .load method, injecting it directly into the page. If you’re using Twenty Fourteen on your own sites, check out the plugin on Github— and if not, feel free to check it out anyway just for the QUnit examples!

As always, if you notice any issues with the code (or have questions about how or why I’m doing things a certain way), feel free to leave a comment or issue on the repository and I’ll answer as soon as possible.

I’m speaking on JS Unit Testing on this month’s WP Sessions!

This coming Saturday, I will be presenting on JavaScript Unit Testing as part of this month’s WP Sessions streaming event. (The end of November snuck up on me fast—this should probably have gone up sooner!)

WPSessions.com is a labor of love by Brian Richards, focused on bringing high-quality, WordCamp-style presentations, streamed right to your browser. Each month a group of speakers are invited to present a series of talks on a specific topic—this week we are focusing on Unit Testing, covering the what, why and how of writing tests in PHP and JavaScript. Some of what we’ll cover is WordPress-specific, but there should be a lot to learn for anybody curious about how to better test their code.

I am honored to be a part of this month’s excellent lineup, and I hope you will join me, Alison Barret and John Bloch online this coming Saturday!

WPSessions November 2013 Flyer

Click on the banner above to sign up—tickets are just $25. (As with WordCamps, the recorded talks will be released for free a few months after the event.)

JSHint patches are landing in WordPress Core

Yesterday we formally kicked off the work to fix JSHint errors in WordPress Core, after a week of preparation, decisions, and work on the JavaScript Code Standards guide. I’m really excited to see how excited everybody has been for this initiative, and tickets are already coming in hard and fast to fix errors in core JS files. Yesterday alone something on the order of half a dozen patches landed in core—won’t take long, at this rate!

With a passing JSHint run we’ll be one step closer to having the front-end tooling infrastructure we deserve. It’s an exciting time to be involved in the project, and I’m grateful to Andrew Nacin, Tom McFarlin and everyone else who’s been supporting and encouraging our efforts.