Skip to content

Instantly share code, notes, and snippets.

@cherrykoda
Created July 13, 2020 13:11
Show Gist options
  • Save cherrykoda/27e9fbe868764ae9d73fc013af5a3df2 to your computer and use it in GitHub Desktop.
Save cherrykoda/27e9fbe868764ae9d73fc013af5a3df2 to your computer and use it in GitHub Desktop.
[Medium] Macros v Partials - Macro Scoping
{# Define Page #}
{% set bodyClass = "article" %}
{% extends "_layouts/main" %}
{# Includes #}
{% import "_macros/designer.twig" as _designer %}
{% import "_macros/actions.twig" as _actions %}
{% import "_macros/ads.twig" as _ads %}
{% block content %}
// Article Content Markup Goes Here
{% embed '_components/_mobile-menu' %}
{% block menu %}
{# macro redefined for menu block (scoping) #}
{% import "_macros/actions.twig" as _actions %}
// Mobile Menu Markup Goes Here
{% endblock %}
{% endembed %}
{% endblock %}
{% block footerJs %}
// Javascript Goes Here
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment