2017 © Pedro Peláez
 

robo-tasks blt-twig

Expands on robo-twig to add additional support for blt

image

heydon/blt-twig

Expands on robo-twig to add additional support for blt

  • Tuesday, June 26, 2018
  • by gheydon
  • Repository
  • 1 Watchers
  • 0 Stars
  • 513 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

BLT Twig bridge

Twig is such a powerful templating language and the built in replace command in robo completely inadiquate. Tasks such as building a default settings.php for Drupal where you take many different variables from the blt config yaml file can very challenging., (*1)

$this->taskReplaceInFile('box/robo.txt')
 ->from(
 [
    '##dbname##',
    '##dbhost##'
 ])
 ->to(
 [
    $this->getConfigValue('drupal.db.database'),
    $this->getConfigValue('drupal.db.host')
 ])
 ->run();

Compared to twig, (*2)

$this->taskTwig($this)
     ->setTemplatesDirectory($this->getConfigValue('repo.root') . '/blt/Templates')
     ->applyTemplate('settings.php.twig', $this->getConfigValue('drupal.settings_file'))
     ->applyTemplate('sites.php.twig', $this->getConfigValue('docroot') . '/sites')
     ->run();

Using the template which is provided., (*3)

$databases['default']['default'] = array (
  'database' => '{{ config.drupal.db.database }}',
  'username' => '{{ config.drupal.db.username }}',
  'password' => '{{ config.drupal.db.password }}',
  'prefix' => '',
  'host' => '{{ config.drupal.db.host }}',
  'port' => '{{ config.drupal.db.port }}',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

The task and config variables are automatically exposed during the ::twigTask(), so your templates have full access to every config variable while it is being generated., (*4)

The Versions

26/06 2018

dev-master

9999999-dev

Expands on robo-twig to add additional support for blt

  Sources   Download

GPL-2.0-or-later

The Requires