heydon/robo-twig

允许通过robo处理模板

维护者

详细信息

github.com/gheydon/robo-twig

源代码

安装次数: 28,846

依赖项: 2

建议者: 0

安全性: 0

星标: 1

关注者: 1

分支: 0

类型:robo-tasks

dev-master 2020-12-09 22:49 UTC

This package is auto-updated.

Last update: 2024-09-10 07:17:08 UTC


README

将twig用作robo的模板系统

用法

  • 使用内存中的模板,并在屏幕上显示
    $this->taskTwig()
      ->setTemplatesArray('index', 'Hello {{ name }}!')
      ->setContext('name', 'Fabien')
      ->applyTemplate('index', '')
      ->run();
  • 使用模板文件并写入目标
    $this->taskTwig()
      ->setTemplatesDirectory('./templates')
      ->setContext('name', 'Fabien')
      ->applyTemplate('index.twig', 'index.txt')
      ->applyTemplate('index.html.twig', 'index.html')
      ->run();