SlideShare a Scribd company logo
Frontend From
ScratchSupercharge page speed with frontend optimisation alone
Yousef
Cisco
@yousefcisco
Frontend From
ScratchSupercharge page speed with frontend optimisation alone
Disclaimer
But why
• Reduce technical debt
• Build only the website your client
needs
• Improve performance &
maintainability
• Magento recommends you build your
own theme
Actually
building a
theme from
scratch
The basics
• Create a new package
• Create a new theme
• Create empty page.xml
BaseBlocker
• Magento forces base/default as a final
fallback
• Rewrite Mage_Core_Model_Design_Package
• Stop fallback to base/default
• Add exceptions for some modules/
vendors
• Example can be found on
http://git.io/BaseBlocker
class Mage_Core_Model_Design_Package
{
protected function _fallback(
$file,
array &$params,
array $fallbackScheme = array(array())
) {
if ($this->_shouldFallback) {
foreach ($fallbackScheme as $try) {
$params = array_merge($params, $try);
$filename = $this->validateFile($file, $params);
if ($filename) {
return $filename;
}
}
$params['_package'] = self::BASE_PACKAGE;
$params['_theme'] = self::DEFAULT_THEME;
}
return $this->_renderFilename($file, $params);
}
http://git.io/BaseBlocker
if ($this->_shouldFallback) {
foreach ($fallbackScheme as $try) {
$params = array_merge($params, $try);
$filename = $this->validateFile($file, $params);
if ($filename) {
return $filename;
}
}
$params['_package'] = self::BASE_PACKAGE;
$params['_theme'] = self::DEFAULT_THEME;
}
http://git.io/BaseBlocker
if ($this->_shouldFallback) {
foreach ($fallbackScheme as $try) {
$params = array_merge($params, $try);
$filename = $this->validateFile($file, $params);
if ($filename) {
return $filename;
}
}
// This condition is added to allow certain files
// to fallback to base/default
if ($this->shouldFallbackToBase($file)) {
$params['_package'] = self::BASE_PACKAGE;
$params['_theme'] = self::DEFAULT_THEME;
}
}
http://git.io/BaseBlocker
protected function shouldFallbackToBase($file)
{
// Allow fallback in adminhtml
if ($this->getArea() != self::DEFAULT_AREA) {
return true;
}
$exceptions = array(
'vendor'
'paypal',
'sagepay',
'payment',
);
// Allow exceptions
foreach ($exceptions as $exception) {
if (stripos($file, $exception) !== false) {
return true;
}
}
return false;
}
http://git.io/BaseBlocker
Add new page type
• Break the shackles of 1column and
2column-left
• Create your own template
• Works well with responsive sites
Tip: create a Page module to add all
these customisations
<global>
<page>
<layouts>
<vendor_page module="page">
<label>Vendor Default</label>
<template>page/html.phtml</template>
<layout_handle>vendor_page</layout_handle>
<is_default>1</is_default>
</vendor_page>
<one_column>
<is_default>0</is_default>
</one_column>
</layouts>
</page>
</global>
http://git.io/config.xml
Hand craft your layout
• Don't copy Magento layout
• Create your own layout files
• Create modular layout
Create your own
templates
• Write clean templates
• Use native templates for inspiration
(don't copy!)
• Use native blocks when required
• Structure your templates well
Integrate Grunt/Gulp
into your workflow
Use these tools to help you build your
websites faster, there's a lot you can
do with this.
Kraken to
optimise image
assets
Create a
custom task to
help with
translations
Generate your
own iconfont
Use LESS/Sass
Merge & Minify JS
Customise the task to
handle theme setup
Merge & Minfiy JS
<action method="addJS">
<name>vendor/dst/global_lib_default.min.js</name>
</action>
<action method="addJS">
<name>vendor/dst/global_lib_mobile.min.js</name>
</action>
Optimise your JS
• Use inline scripts only to output
JSON data
• Load all scripts at the bottom of
the page
• Merge scripts based on pages
• Preload scripts on linear user
journey
Turn off
Magento's CSS
& JS merging
Use your JS
Mustache
Mustache
Allows you to render the same
template server side and client side
Ampersand/Mustache
amp.co/mustache
Ditch default
Beat the bloat
Build from
scratch
Questions?
Thank you

More Related Content

PPTX
Up & Running with Polymer
PPTX
9. lower in Symfony 4
PDF
Web Components: What, Why, How, and When
PDF
Optimizing AngularJS Application
PDF
Beyond DOM Manipulations: Building Stateful Modules with Events and Promises
PPTX
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
PDF
Plugging into plugins
PDF
J!Layout Overrides Einstieg und Beispiele
Up & Running with Polymer
9. lower in Symfony 4
Web Components: What, Why, How, and When
Optimizing AngularJS Application
Beyond DOM Manipulations: Building Stateful Modules with Events and Promises
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
Plugging into plugins
J!Layout Overrides Einstieg und Beispiele

What's hot (20)

PDF
Alchemy CMS Präsentation Rails UG HH 09.2011
PPTX
7. copy2 in Symfony 4
KEY
Html5 nl
PPT
WordPress theme frameworks
PPTX
jQuery Performance Tips and Tricks
PDF
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
PPTX
Blade Template and Laravel
PDF
Manipulating Magento - Meet Magento Belgium 2017
PDF
Black-Scholes Calculator on Web
PDF
Streamlining Your Applications with Web Frameworks
PDF
Introduction to Using PHP & MVC Frameworks
PDF
A modern front end development workflow for Magnolia at Atlassian
PPTX
Build a Better Editing Experience with Advanced Custom Fields
PPTX
React basic by Yoav Amit, Wix
PPT
AngularJS for Legacy Apps
PDF
Haml. New HTML? (RU)
PDF
Mastering WordPress Vol.1
PDF
Front End Development - Beyond Javascript (Robin Cannon)
DOC
Vijesh Pachatiyan 2016
PPTX
BOOM Performance
Alchemy CMS Präsentation Rails UG HH 09.2011
7. copy2 in Symfony 4
Html5 nl
WordPress theme frameworks
jQuery Performance Tips and Tricks
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Blade Template and Laravel
Manipulating Magento - Meet Magento Belgium 2017
Black-Scholes Calculator on Web
Streamlining Your Applications with Web Frameworks
Introduction to Using PHP & MVC Frameworks
A modern front end development workflow for Magnolia at Atlassian
Build a Better Editing Experience with Advanced Custom Fields
React basic by Yoav Amit, Wix
AngularJS for Legacy Apps
Haml. New HTML? (RU)
Mastering WordPress Vol.1
Front End Development - Beyond Javascript (Robin Cannon)
Vijesh Pachatiyan 2016
BOOM Performance
Ad

Similar to Fronted From Scratch - Supercharge Magento page speed (20)

PDF
TurboGears2 Pluggable Applications
PDF
Magento Performance Optimization 101
PDF
Javascript ui for rest services
PPTX
Magento mega menu extension
PDF
Stencil the time for vanilla web components has arrived
DOC
.NET 1.1 Base Page Framework Article
KEY
Templates
PPT
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
PDF
Magento x codekit x sass x compass x skeleton responsive grid
PDF
Web-Performance
PDF
Designing for magento
PPTX
WordPress Structure and Best Practices
PDF
T5 Oli Aro
PPTX
Building Potent WordPress Websites
PDF
The Dojo Build System
PDF
Web Components v1
PDF
Magento 2 Design Patterns
PDF
7 reasons why developers should love Joomla!
PDF
Drupal front-end performance
PDF
D7 theming what's new - London
TurboGears2 Pluggable Applications
Magento Performance Optimization 101
Javascript ui for rest services
Magento mega menu extension
Stencil the time for vanilla web components has arrived
.NET 1.1 Base Page Framework Article
Templates
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Magento x codekit x sass x compass x skeleton responsive grid
Web-Performance
Designing for magento
WordPress Structure and Best Practices
T5 Oli Aro
Building Potent WordPress Websites
The Dojo Build System
Web Components v1
Magento 2 Design Patterns
7 reasons why developers should love Joomla!
Drupal front-end performance
D7 theming what's new - London
Ad

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
cuic standard and advanced reporting.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation theory and applications.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Empathic Computing: Creating Shared Understanding
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
Reach Out and Touch Someone: Haptics and Empathic Computing
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
cuic standard and advanced reporting.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Empathic Computing: Creating Shared Understanding
Dropbox Q2 2025 Financial Results & Investor Presentation
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectral efficient network and resource selection model in 5G networks
“AI and Expert System Decision Support & Business Intelligence Systems”
Advanced methodologies resolving dimensionality complications for autism neur...
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
Understanding_Digital_Forensics_Presentation.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

Fronted From Scratch - Supercharge Magento page speed