Facades are a structural design pattern from the Gang of Four book, Design Patterns. They are used to hide the complexity of underlying services and allow clients to call a simpler method to achieve their desired result. Think of it like the front of a building hiding the contents inside from passersby, or the facade on a library hiding the complexities within the shelves and stacks of books.

The main purpose of the facade is to protect your application code from interacting directly with the underlying service. The facade will provide a limited interface to the class that implements the desired functionality and the rest of the world will use that interface to interact with the class. This provides a more terse and memorable syntax and allows for better testability.

Aside from their benefits in terms of a more readable and readable CSS Facades website codebase, facades also have several other advantages over direct use of the underlying service. One of the most significant is that it allows for lazy loading and other web performance best practices, which can drastically improve page speed, especially when used with popular third-party embeds like social media feeds, ad widgets, and video or audio players.

This article will explore some of the most common uses of facades and how to apply them to your projects. We will cover everything from how to identify your most expensive third-party embeds that can benefit from lazy loading, to how to load a facade in place of the actual third-party embed in order to achieve similar results without impacting page speed.

Third party-apps are a great addition to many websites and can add value in terms of customer service and sales conversion. However, not every user visiting a restaurant website will use the interactive map embed, or each visitor to a telecom service provider’s website will want to speak with a live representative through the chatbot plugin. These tools can be costly for your site’s performance if they are loaded as a fully functional, interactive iframe.

By using a facade, you can replace the third-party embed with a static image or an HTML fragment that will display the same information, but not actually execute any scripts. This can significantly lower the burden on your website’s performance and prevent those third-party apps from slowing down your site or becoming a distraction or source of direction away from your content.

You can use the npm package facade-css to build your own custom facades, or you can take advantage of free, open source, facade packages already available for your use. These packages can be installed using NgRx by adding them to your application’s dependencies. Facades also enable NgRx to perform dependency injection in the same way as normal classes and can be tested with NgRx’s built-in facade testing helpers.