{"id":299260,"date":"2019-11-19T10:06:50","date_gmt":"2019-11-19T17:06:50","guid":{"rendered":"https:\/\/css-tricks.com\/?p=299260"},"modified":"2019-11-19T10:06:50","modified_gmt":"2019-11-19T17:06:50","slug":"oh-the-places-javascript-will-go","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/oh-the-places-javascript-will-go\/","title":{"rendered":"Oh, the Places JavaScript Will Go"},"content":{"rendered":"

I tend to be pretty vocal about the problems client-side JavaScript cause from a performance perspective. We’re shipping more JavaScript than ever to our user’s devices and the result is increasingly brittle and resource-intensive experiences. It’s… not great.<\/p>\n

But that doesn’t mean I don’t like JavaScript. On the contrary, I enjoy working in JavaScript quite a bit. I just wish we were a little more selective about where<\/em> we use it.<\/p>\n

<\/p>\n

What excites me is when JavaScript starts reaching into parts of the technical stack where it didn’t live before. Both server-side programming and the build tool process weren’t exactly off-limits to front-end developers, but before Node.js and tools like Grunt, Gulp, webpack, and Parcel came along, they required different languages to be used. There are a lot of improvements (asset optimizations, test running, server-side adjustments necessary for improved front-end performance, etc) that required server-side languages, which meant most front-end developers tended not to go there. Now that those tools are powered by JavaScript, it’s far more likely that front-end developers can make those changes themselves.<\/p>\n

Whenever we take a part of the technology stack and make it more approachable to a wider audience, we’ll start to see an explosion of creativity and innovation. That’s exactly what’s happened with build processes and bundlers. There’s been an explosion of innovation in no small part thanks to extending where front-end developers can reach.<\/p>\n

That’s why I’m really excited about edge computing solutions.<\/p>\n

Using a CDN is one of the most valuable things you can do to improve performance and extend your reach. But configuring that CDN and getting the maximum amount of value has been out of reach for most front-end teams.<\/p>\n

That’s changing.<\/p>\n

Cloudflare has Cloudflare Workers<\/a>, powered by JavaScript. Akamai has EdgeWorkers<\/a>, powered by JavaScript. Amazon has Lambda@Edge<\/a>, powered by JavaScript. Fastly just announced Compute@Edge<\/a> which is powered by WebAssembly. You can’t write JavaScript at the moment for Compute@Edge (you can write TypeScript if that’s your thing), but I suspect it’s only a matter of time before that changes.<\/p>\n

Each of these tools provides a programmable layer between your CDN and the people visiting your site, enabling you to transform your content at the edge before it ever gets to your users. Critically, all of these tools make doing these things much more approachable to front-end developers.<\/p>\n

For example, instead of making the client do all the work for A\/B testing, you can use any one of these tools to handle all the logic on the CDN instead, helping to make client-side A\/B testing (an annoyance of every performance-minded engineer ever) a thing of the past. Optimizely’s already using this technology to do just that for their own A\/B testing solution<\/a>.<\/p>\n

Using a third-party resource? Edge computing makes it much easier to proxy those requests through your own CDN<\/a>, sparing you the extra connection cost and helping eliminate single point of failures.<\/p>\n

Custom error messages? Sure. User authentication? You betcha. Personalization? Yup. There’s even been some pretty creative technical SEO work<\/a> happening thanks to edge computing.<\/p>\n

Some of this work was achievable before, but often it required digging through archaic user interfaces to find the right setting or using entirely different languages and tools like ESI or Varnish which don’t really exist outside of this little sliver of space they operate in.<\/p>\n

Making these things approachable to anyone with a little JavaScript knowledge has the potential to help be a release valve of sorts, making it easier for folks to move some of that heavy work away from client devices and back to a part of the tech stack that is much more predictable and reliable. Like Node.js and JavaScript-driven build tools, they extend the reach of front-end developers further.<\/p>\n

I can’t wait to see all the experimentation that happens.<\/p>\n","protected":false},"excerpt":{"rendered":"

I tend to be pretty vocal about the problems client-side JavaScript cause from a performance perspective. We’re shipping more JavaScript than ever to our user’s devices and the result is increasingly brittle and resource-intensive experiences. It’s… not great. But that doesn’t mean I don’t like JavaScript. On the contrary, I enjoy working in JavaScript quite […]<\/p>\n","protected":false},"author":270824,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"art-direction\/eoy-2019.php","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[7238],"tags":[],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":361241,"url":"https:\/\/css-tricks.com\/node-and-how-it-works-with-npm\/","url_meta":{"origin":299260,"position":0},"title":"What the Heck is Node?","date":"January 20, 2022","format":false,"excerpt":"Here\u2019s what you need to know about Node.js (or simply Node) and how it relates to npm right off the bat: Node is JavaScript, but as a server-side language.This is possible because of V8, Chromium\u2019s JavaScript engine, which can run on its own, outside the confines of the browser.Node and\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/01\/node-js-logo.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":316692,"url":"https:\/\/css-tricks.com\/three-css-alternatives-to-javascript-navigation\/","url_meta":{"origin":299260,"position":1},"title":"Three CSS Alternatives to JavaScript Navigation","date":"July 14, 2020","format":false,"excerpt":"Hey quick! You\u2019ve gotta create the navigation for the site and you start working on the mobile behavior. What pattern do you choose? If you\u2019re like most folks, it\u2019s probably the \u201chamburger\u201d menu that, when clicked, uses a little JavaScript to expand a vertical list of navigation links. But that\u2019s\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/01\/hamburger-menu.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":305435,"url":"https:\/\/css-tricks.com\/getting-javascript-to-talk-to-css-and-sass\/","url_meta":{"origin":299260,"position":2},"title":"Getting JavaScript to Talk to CSS and Sass","date":"April 3, 2020","format":false,"excerpt":"JavaScript and CSS have lived beside one another for upwards of 20 years. And yet it\u2019s been remarkably tough to share data between them. There have been large attempts, sure. But, I have something simple and intuitive in mind \u2014 something not involving a structural change, but rather putting CSS\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/03\/css-sass-js.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":320479,"url":"https:\/\/css-tricks.com\/import-non-esm-libraries-in-es-modules-with-client-side-vanilla-js\/","url_meta":{"origin":299260,"position":3},"title":"Import Non-ESM libraries in ES Modules, with Client-Side Vanilla JS","date":"September 7, 2020","format":false,"excerpt":"We're living through a weird era where there are tons of JavaScript libraries that were meant to be used as