Skip to content

Instantly share code, notes, and snippets.

Avatar

Mario Hernandez mariohernandez

View GitHub Profile
View .ddev-docker-compose-patternlab.yaml
# docker-compose.patternlab.com to pass port 3000 inside the container
# to https://<something>.ddev.site:3001
version: '3.6'
services:
web:
ports:
# Expose port 3000 for the patternlab app
- "3001"
environment:
# Override the web container's standard HTTP_EXPOSE and HTTPS_EXPOSE
View settings.ddev.php
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
$settings['cache']['bins']['page'] = 'cache.backend.null';
View .stylelintrc.yml
# Custom configuration for Stylelint.
#
# Preset all items to warning to prevent breaking themes.
# Delete line to activate linter build-breaking errors.
defaultSeverity: warning
# Plugins integrated.
plugins:
- stylelint-scss
View menu-good-markup.html
<nav class="main-menu">
<ul class="main-menu__list">
<li class="main-menu__item main-menu__item--level-0">
<a href="/" class="main-menu__link">About Us</a>
</li>
<li class="main-menu__item main-menu__item--level-0">
<a href="#" class="main-menu__link">Our Services</a>
<ul class="main-menu__submenu">
<li class="main-menu__item main-menu__item--level-1">
<a href="#" class="main-menu__link">Training</a>
View menu-plain.html
<ul>
<li>
<a href="#">Top level link</a>
</li>
<li>
<a href="#">Top level link</a>
<ul>
<li>
<a href="#">First submenu link</a>
<ul>
View menu-macro.html.twig
{% import _self as menus %}
{{ menus.main_menu(items, attributes, 0) }}
{% macro main_menu(items, attributes, menu_level) %}
{% import _self as menus %}
{% if items %}
{% if menu_level == 0 %}
<ul{{ attributes }}>
{% else %}
View main-menu.scss
.main-menu {
background: #424242;
height: 60px;
}
.main-menu__list {
align-items: center;
background-color: transparent;
display: flex;
height: 60px;
View _main-menu-macro.twig
{#
/**
* @file
* Theme override to display a menu.
*
* Available variables:
* - menu_name: The machine name of the menu.
* - items: A nested list of menu items. Each menu item contains:
* - attributes: HTML attributes for the menu item.
* - below: The menu item child items.
View main-menu.yml
items:
- title: 'Home'
url: '#'
menu_level: 0
- title: 'About Us'
url: '#'
menu_level: 0
below:
- title: 'Our Team'
url: '#'
View main-menu-include.twig
{%
set classes = [
'block',
'block-' ~ configuration.provider|clean_class,
'block-' ~ plugin_id|clean_class,
]
%}
{% set attributes = attributes.addClass(classes) %}
{% embed '@sixflags_theme/main-menu/main-menu.twig' with {
attributes: attributes,
You can’t perform that action at this time.