Web Tools Weekly
What a Tool!

Issue #234  (Nested Literals, JS Lib Plugins, Productivity, JS Utils)

Here's a quick tip on using ES6 template literals. As you probably know, template literals allow you to insert a JavaScript expression using ${} to include a variable within a string. These placeholders (also referred to as substitutions) need not be merely variable references, but can be any JavaScript expression (a calculation, function call, etc).

On top of that, since a template literal placeholder itself is a JavaScript expression, you can nest a placeholder within a placeholder. Here's an example, similar to one used in MDN's article on the topic:

// mock functions
function isLargeScreen() {
  return false;

function isCollapsed() {
  return true;

// nested template literals
const classes = `header ${ isLargeScreen() ? '' :
icon-${(isCollapsed() ? 'expander' : 'collapser')}` }`;


JS Bin demo

The key portion of the code is the line that defines the classes constant. Notice the ternary expression that begins inside the first placeholder. If isLargeScreen() evaluates to false, another ternary expression is evaluated using isCollapsed(), which itself nests another placeholder inside the original.

This is just another way that template literals make dealing with strings much easier in JavaScript. A technique like this was certainly possible in ES5, but it's a little more elegant and easier to maintain using template literals.

Now on to this week's learning tools!
Did you buy my previous JavaScript/DOM tips book? Here's the latest one...
70 JavaScript & DOM Tips for $5 (Volume 2)

JavaScript Library Plugins & Tools

Angular plugin for imaskjs, the form input mask utility.

Angular Controls
The first complete collection of Angular components.

A premium calendar jQuery plugin pack that supports 13 languages, 
4 calendar types, and more.

Easy guided tours for Angular apps.

A jQuery plugin for creating GitHub Punchcard like graphs.

A jQuery plugin for making smart sticky elements.

An open source toolkit for enterprise Angular applications.

jQuery contextMenu
Plugin to add advanced context menu functionality to your apps.

A lightweight jQuery plugin to create grid based responsive tabs.

Productivity Tools

App for creating a timeline of a project as it progresses. By easily logging the past, present, and future, it keeps everyone on the same page and gives you clarity to do your best work.

Array Explorer
Find the JavaScript array method you need without digging through the docs.

Collaborative boards that simplify UX planning. Share documents, lists, prototypes, and designs in one place.

Free time tracking tool for agencies and freelancers.

Chrome extension. Know everything about your Gmail contacts, right from your inbox.

Supercharge your email discussions. Boost your team’s knowledge with a powerful shared archive.

Manage your time like a pro. Automatically prioritises your tasks, helping you to work smarter.

Visual feedback and bug reporting tools for web professionals. Makes it easy for non technical people to report visual bugs to dev teams.

Do you like this newsletter? Here's an option to show your support...
Make a One-time Donation via PayPal.me/WebToolsWeekly

JavaScript Modules and Utilities

Lightweight, high-performance JavaScript plugin for detecting and manipulating elements in the browser.

API to add select-to-highlight and share functionality (like Medium) to web content.

System for creating programs that manage changing numbers over time. It's especially useful for creating idle games (sometimes called incremental games).

Direction Reveal
Direction aware content reveals. Detects which direction a user enters/exits a block, allowing you to reveal/hide content accordingly.

A collection of JavaScript libraries for Progressive Web Apps.

Cross domain post-messaging on the client side, using a simple listener/client pattern.

Simple and modern async event emitter. Emitting events asynchronously is important for production code where you want the least amount of synchronous operations.

A powerful, modern, and friendly wrapper for JavaScript dates and times.

Pretty Scroll
A sticky element plugin to make an element follow you as you scroll. Has a simple API with options for a breakpoint and location of the sticky item.

A Tweet for Thought

Discussion begun by Sara Soueidan on whether it's overly negative to focus too much on lack of browser support for new features. I'm on the fence on this one, but I do feel pragmatism isn't necessarily negativism.

Send Me Your Tools!

Made something? Send links via Twitter @WebToolsWeekly (details here). No tutorials or articles, please. If you have any suggestions for improvement or corrections, feel free to reply to this email.

Before I Go...

You might like 30 seconds of code, a curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.

Thanks to all for subscribing and reading!

Keep tooling,