Objectives

  1. Understand how client-side libraries are included onto a page via an editable template.
  2. Learn how to use the ui.frontend module and a webpack development server for dedicated front-end development.
  3. Understand the end-to-end workflow of delivering compiled CSS and JavaScript to a Sites implementation.

What you are going to build

In this chapter, you add some baseline styles for the WKND site and the Article Page Template to bring the implementation closer to the UI design mockups. You use an advanced front-end workflow to integrate a webpack project into an AEM client library.

Finished Styles

Article Page with baseline styles applied

Background

Client-Side Libraries provide a mechanism to organize and manage CSS and JavaScript files necessary for an AEM Sites implementation. The basic goals for client-side libraries or clientlibs are:

  1. Store CSS/JS in small discrete files for easier development and maintenance
  2. Manage dependencies on third-party frameworks in an organized fashion
  3. Minimize the number of client-side requests by concatenating CSS/JS into one or two requests.

More information about using Client-Side Libraries can be found here.

Client-side libraries do have some limitations. Most notably is a limited support for popular front-end languages like Sass, LESS, and TypeScript. In the tutorial, let’s look at how the ui.frontend module can help solve this.

Deploy the starter code base to a local AEM instance and navigate to http://localhost:4502/editor.html/content/wknd/us/en/magazine/guide-la-skateparks.html. This page is unstyled. Let’s implement Client-side libraries for the WKND brand to add CSS and JavaScript to the page.