Today’s a slight change of pace. We’re going to a review a new Magento 2 book, Theme Web Page Assets: Getting Stuff Done with Magento 2.
This book is part of Alan Kent’s Getting Stuff Done with Magento 2 series of ebooks, and the first book in the series with real substance behind it. If you’re not familiar with Alan’s work, he was Magento 2’s “lead architect” during the last bit of the eBay days, and took on the role of VP of Architecture when eBay spun Magento off as an independent company.
We mention all this not to put Alan’s career in the spotlight, but to highlight that fact that, despite not being a book that’s officially released by Magento Inc., (with an explicit disclaimer that its opinions are Alan’s alone), when a lead architect talks about the technical details of the platform he’s architecting, it’s wise to pay attention. While architect seems more of a management role than a hands on systems coding position, the leader of the technology team is bound to have some useful things to say about a platform.
For the impatient? The book’s worth buying, especially in these early days when varied knowledgeable opinions about Magento 2 are hard to find. It’s well thought out, well written, and takes the tried and true approach of telling you want you’re about to learn, teaching it to you, and then telling you what you learned.
Theme Web Page Assets: Getting Stuff Done with Magento 2 also takes a slightly different tact that I do. My not-so-secret goal here is to make you a better programmer, because programming is not as hard as it seems. While all my articles have a practical goal in mind, they also push you to think about how a system’s implemented, and realize that it’s just PHP code all the way down. The kernel level of my articles center around PHP and programming.
The kernel of Theme Web Page Assets: Getting Stuff Done with Magento 2 centers around HTML, CSS, and javascript. It’s written to teach you how Magento’s systems should be used, not how they’re implemented. This approach has its pros and cons, but it’s useful to look at any technical platform from multiple points of view.
What’s Covered
In short, when you pickup a copy of Theme Web Page Assets: Getting Stuff Done with Magento 2, you’ll end up learning about the following Magento specific topics
- How to add a Theme Component
- How to add a CSS File to a Theme
- How to add a Block and Template to a page Footer Image
- How to Replace an Existing base Theme Image
- How Theme Files Resolve
- Theme Inheritance
- How to use Magento for Basic Responsive Web Design/Media Queries
- Magento LESS CSS features
- UI library
- @magento_import
- How to Clear Static Cache Files
- How to Explore/Debug a UI feature to add CSS/Less
- Basics of Using Layout Handle XML Files and Blocks
- How to use Block Arguments
- How to use Show Template Hints
- PHP code in phtml Templates
- Magento’s RequireJS basics
- How to add a Magento Module to add javascript files and features
data-mage-init
javascript initializationtext/x-magento-init
javascript initialization
- Magento’s gettext style
__
function for locale-translating symbols - How to Add Fonts to a Theme
- Basics of Submitting a Theme to Magento Connect
The book also, inevitably, touches on some general web development topics that aren’t specific to Magento.
- Some CSS basics
- CSS Optimization Trade Offs (merging vs. not, HTTP V1 vs. HTTP V2)
- Introduction to Less CSS
- Less CSS @import Statement
- Less CSS mixins
- Gulp workflows for CSS Generation
- jQuery Widgets
The book is structured around a series of How To steps where Alan walks you through how to perform some task related to creating or editing a theme. While no example goes too in depth, they do give you that all important starting point that can be the difference between taking that first step, and throwing up your hands in frustration.
This book is also the first place I’ve seen some specific topics covered — I even managed to learn a thing or two about the data-mage-init
and text/x-magento-init
javascript embedding.
If the above sounds good to you and you’re working professionally in the Magento space, the book’s $9 price tag is well worth it.
What’s Not Covered
Theme Web Page Assets: Getting Stuff Done with Magento 2 is about a 100 “Kindle pages” long — that is, each page press on my Kindle marked the book done by another percent mark. Its short, to the point, and as a result there’s a few you won’t find.
First, and of greatest interest to the readers of this web site, there’s no coverage of how these features are implemented. The layout handle XML files are treated more as configuration files than the true domain specific language they are, and the only mention of PHP code is block class names and phtml templates. While the book never sets out to cover this, if you were hoping for some software architecture secrets from Magento’s lead architect, you’ll need to look elsewhere.
Second, the book offers no strong opinions how how or why you’d choose a particular theming approach over another. When to use CSS vs. Less is glossed over, as is the best times to use the data-mage-init
javascript initialization over the text/x-magento-init
javascript initialization method. As leader of an enormous software team, it’s probably not wise for a VP of Engineering to favor one solution over another, but a larger discussion of the tradeoffs involved or the thinking of the core team thinking around these features would be welcomed.
Finally, this book only show you how to get to the trailhead. That is, it puts the tools of Magento’s theming system in your hands, but its still going to be up to you to figure out what sections of Magento need theming, and which ones don’t. If you’re looking for that comprehensive guide to Magento theming, this book will give you the information you need to research your own, but it won’t provide an in depth guide for your front end developers to follow when building out a store theme. As always with ecommerce systems, that job is left to the men and women in the trenches, desperately avoiding meetings so they can get some work done.
Wrap Up
All in all Theme Web Page Assets: Getting Stuff Done with Magento 2 is a welcome addition to the growing body of knowledge on Magento 2 development. While it would be nice if Magento Inc. could find a way to allocate a few more architects and programmers to the Dev Docs team, this no nonsense guide to Magento 2 Theme Development will go a long way towards getting front end design-agency developers on track to working on their first Magento 2 project.