Creating a new theme

Themes in Magento 2 are set up a bit differently than Magento 1. Some of these changes are as follows:

  • Smaller layout files per layout handle
  • Less (default) implementation with an internal Less preprocessor
  • Extended layout methods to move and change blocks
  • Magento UI library for default components, such as forms, buttons, and more
  • Installable through Composer
  • Fallback to module layout, templates, and other public files
  • Static file generation to improve page load times

In this sample theme, the files are located in app/design/frontend/<Vendor>/<Theme>. When a theme is installed through Composer, it will be installed in the vendor directory.

Getting ready

In order to work with themes, you should have a basic knowledge of XML, HTML, CSS, ...

Get Magento 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.