Skip to content

Instantly share code, notes, and snippets.

Avatar

Danny Englander danny-englander

View GitHub Profile
@startinggravity
startinggravity / lando-emulsify.md
Last active Oct 29, 2019
Using Lando with Emulsify
View lando-emulsify.md

I have had a few requests for more information about using Lando with Drupal 8, the Emulsify theme and Gulp. In order to put what I've learned in one place, I'm adding my notes here.

My initial problem was reported here, but since then I have discovered a few additional things worth noting.

Once you have a working site on Lando and are ready to install Emulsify use the following directions instead of what has provided by the Emulsify developers. These instructions assume you have used Composer to install Drupal and that the root Drupal files are in the /web directory.


NOTE: To follow these instructions, you will need to run NPM commands from your host machine, which means you must have Node and NPM installed. Fortunately, they are installed together in one installation. If you wish to confirm you have them installed, run node -v and npm -v. To install, visit nodejs.org and follow the i

@froboy
froboy / nucular-option.sh
Last active Jul 21, 2020
Sometimes composer (in your Drupal 8 environment) gets grupmy... when that happens, it's time to go nucular.
View nucular-option.sh
######
# This script intentionally deletes a lot of things that could be important!!!!!
# Please be sure you have a backup before you go nucular!!!!!
#####
# Depending on where your web root is...
rm -rf vendor/ && rm -rf web/core && rm -rf web/modules/contrib/ && rm -rf composer.lock
# or
rm -rf vendor/ && rm -rf docroot/core && rm -rf docroot/modules/contrib/ && rm -rf composer.lock
@NikLP
NikLP / zebra.html.twig
Last active Feb 25, 2021
Set zebra-style (odd/even) classes in twig loop in drupal 8 (bootstrap) theme
View zebra.html.twig
<div{{ attributes.addClass('container') }}>
{% for item in items %}
{# NB! notation: loop.index is 1 start, loop.index0 is zero start #}
<div class="row {{ loop.index0 is odd ? 'zebra-odd' : 'zebra-even' }}">
<div{{ item.attributes }}>{{ item.content }}</div>
</div>
{% endfor %}
</div>
@konstantin-morenko
konstantin-morenko / list-categories-count.liquid
Last active Jan 21, 2021 — forked from Phlow/list-categories-count.liquid
Jekyll: List all categories with according post count and show and link all post items listed in the according category
View list-categories-count.liquid
<h2>Categories</h2>
<ul>
{% assign categories_list = site.categories %}
{% if categories_list.first[0] == null %}
{% for category in categories_list %}
<li><a href="#{{ category }}">{{ category | capitalize }} ({{ site.tags[category].size }})</a></li>
{% endfor %}
{% else %}
{% for category in categories_list %}
<li><a href="#{{ tag[0] }}">{{ category[0] | capitalize }} ({{ category[1].size }})</a></li>
View _utility.border.scss
/*
Borders
- - - - - - - - - - - - - - - - - - - - - - - - -
Helper classes for adding borders to elements
Class names follow this convention:
.[type][direction][size]
@lewisnyman
lewisnyman / field.html.twig
Last active Dec 21, 2016
minimal field.html.twig — Drupal 8
View field.html.twig
{% for item in items %}
{{ item.content }}
{% endfor %}
@jacurtis
jacurtis / _spacing-helpers.scss
Last active Jun 10, 2021
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
View _spacing-helpers.scss
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@nadavoid
nadavoid / composer-pantheon.md
Last active Nov 7, 2016
Using composer to manage a single site build on Pantheon
View composer-pantheon.md

This doc has been moved to my blog: https://www.davidlanier.com/blog/2016/11/using-composer-on-pantheon

I worked through https://pantheon.io/blog/using-composer-relocated-document-root-pantheon and chased a few rabbits, and ultimately landed on what I think a pretty simple workflow. The main thing I was interested in was how to use composer to effectively manage a drupal project on pantheon. Composer is practically required for building the codebase of Drupal 8 because there are so many external dependencies now. Composer handles downloading the right versions of all packages.

The main steps:

  • Create a new site at pantheon, selecting "Drops 8 Composer"
@jacine
jacine / icon.html.twig
Last active Nov 2, 2016
Icons for Menu Item links broke with 8.2 upgrade!
View icon.html.twig
{#
/**
* @file
* Drupal pass-through template for icon theme hook implementation.
*
* @see /themes/THEME/components/icon.twig.
*/
#}
{% embed '@components/icon.twig' %}{% endembed %}
@waako
waako / themename.theme.php
Last active Oct 6, 2016
Drupal 8 Block and Menu template suggestions
View themename.theme.php
<?php
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function THEMENAME_theme_suggestions_block_alter(array &$suggestions, array $variables) {
$block_id = $variables['elements']['#id'];
// See if block ID contains the word mobile.
$is_mobile_block = strpos($block_id, 'mobile');
$block = \Drupal\block\Entity\Block::load($block_id);