Space48
magetitans
November 21, 2016

Front-end development in Magento 2

Last Monday was a little different to other Mondays. In the wake of Mage Titans, our Magento developer conference in Manchester Saturday 12th November, the whole team came back to the office fully charged and excited to put their learnings into practice. We asked our dev’s what talks they personally found the most interesting and if they could summarise their favourite talk to share with others; perhaps for those who couldn’t attend or simply wanted to recap.

Our front-end developer, Ben shares his thoughts on Max Bucknell’s talk the ‘Present and future of front-end development in Magento 2‘. This was the only talk solely focused on front-end, so if your a front-end dev working with Magento, it’s definitely worth a viewing.

Max’s talk was about the present state of front-end in Magento 2 and where the future could take us. The main points I took away from the talk was that front-end development moves way faster than Magento can, but that’s OK as we have a great community that helps to push this forward (such as Snowdog Apps with Frontools and the Sass blank theme).

Max broke down Magento 2 into 4 sections and gave each a rating (some humour was thrown in in the form of emojis which always brightens a talk up).

screen-shot-2016-11-16-at-16-36-31

Developer experience

He gave the developer experience a rating of D, mainly due to the extra time taken to run commands and compile Less. His point being that a framework should make a developer’s life easier, not more difficult. Although Magento are listening to us and are currently working on improving this process such as reducing the time taken when running commands and adding Sass to Magento 2 (currently being managed by Bartek at Snowdog Apps).

This is evidence of how the community can help push things forward with Magento, the default static content deploy compilation can take minutes. The Frontools Gulp setup can do this in approx 6 seconds.

Max’s suggestions to Magento are:

  • Decrease time to build
  • Make developers love working on your platform, or at least not dislike it
  • Minimises WTFs/min

He also mentioned how ES6 will be the next big thing for front-end developers, and although it isn’t currently supported in all browsers it can be compiled via Babel.

Performance

Performance was rated as a B, mainly as it’s a huge improvement over Magento 1.

Max’s performance tip: Use AJAX for all customer data, this maximises varnish usage.

Capability

Magento 2 has upped its game with the use of newer technologies such as Less, Knockout JS, Require JS, and (mostly) ditching the now outdated and often hated Prototype.

Max mentions how few people understand how Knockout works in Magento, and how we need to work together to learn these new technologies and kill old habits such as checking the core for examples (as Magento don’t always follow their own best practices!).

Max’s suggestions to Magento:

  • Improve documentation coverage
  • More training
  • Build expertise
  • Kill old habits
  • Adopt their own best practices

Security

I always get the impression that Max is big on security, and he backed that up at Mage Titans with some detailed info on how security can be improved in Magento 2.

His first suggestion is to use subresource integrity, to ensure that files are only run if the hash matches the one provided. If the hash doesn’t match it may break the site, but your customers will remain safe.

screen-shot-2016-11-16-at-16-59-10

The next method to improve security is to prevent cross site scripting (XSS). This is a special header that informs the browser which domains are trusted, if a domain isn’t whitelisted then the script is rejected and does not run.

In summary

I enjoyed Max’s talk and took quite a bit away from it, mainly that we need to do more to improve security, and Magento 2 is an improvement over Magento 1 but the community needs to work together to get it where we want.

Ben Marks from Magento was also listening to Max talk and seemed to really pay attention to his feedback, this furthers my opinion that Magento is putting in extra effort to listen to front-end developers. In my opinion, this attention is long overdue and I’m excited for the future of Magento 2!

If you want to watch to Max Bucknell’s talk, you can now on our Mage Titans YouTube channel.