Skip to content

Instantly share code, notes, and snippets.

@camoa
camoa / frontend-assets.sh
Last active September 25, 2019 19:03
Script to compile assets for theme's
#!/bin/bash
#locate the script in the themes folder
cd docroot/themes/custom
themes=$(find . -type d -maxdepth 1)
for theme in "${themes[@]}"; do
echo "Checking theme $theme\n"
if [ ! -e "$theme/gulpfile.js" ];then
cd $theme
@camoa
camoa / frontent-install.sh
Last active September 25, 2019 18:35
A front end tolols install for VBLT multisites looking for ways to move between folders easily (as they add more folders to the themes)
#!/bin/bash
#locate the script in the themes folder
cd docroot/themes/custom
themes=$(find . -type d -maxdepth 1)
for theme in "${themes[@]}"; do
echo "Checking theme $theme\n"
if [ ! -e "$theme/node_modules" ];then
cd $theme
@camoa
camoa / lotus.js
Created April 13, 2017 15:55
Passing settings to a javascript library
(function ($, Drupal, drupalSettings) {
Drupal.behaviors.LotusBehavior = {
attach: function (context, settings) {
// can access setting from 'drupalSettings';
var lotusHeight = drupalSettings.lotus.lotusJS.lotus_height;
$('lotusElement').css('height', lotusHeight);
}
};
})(jQuery, Drupal, drupalSettings);
@camoa
camoa / lotus.libraries.yml
Last active June 26, 2020 03:24
D728 Task-23 Pre-process output provided by other modules
lotus-js:
version: 1.x
js:
js/lotus.js: {}
dependencies:
- core/jquery
@camoa
camoa / LotusController.php
Last active June 26, 2020 03:31
D728: Task-24 Define a custom template for module output
/**
* @file
* Contains \Drupal\lotus\Controller\LotusController.
*/
namespace Drupal\lotus\Controller;
use Drupal\Core\Controller\ControllerBase;
class LotusController extends ControllerBase {