Twig開発用の設定

カテゴリ テーマ コアバージョン 8.3x 関連モジュール Core

テーマシステム(Twig)を開発するための設定方法

コメント

ユーザー actbrain の写真

■ settings.local.phpを作成する
$ cd /path/to/document-root/sites/default
$ cp ../example.settings.local.php settings.local.php

■ settings.local.php から development.service.yml を読み込むようにする
$ cd /path/to/document-root/sites/default
$ vim settings.local.php
$ diff -upN ../example.settings.local.php settings.local.php

-# $settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
+$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

-# $settings['cache']['bins']['render'] = 'cache.backend.null';
+$settings['cache']['bins']['render'] = 'cache.backend.null';

-# $settings['cache']['bins']['discovery_migration'] = 'cache.backend.memory';
+$settings['cache']['bins']['discovery_migration'] = 'cache.backend.memory';

+$settings['file_private_path'] = '/path/to/private'; // ついでにプライベートディレクトリを定義する

■ development.service.yml にデバッグ用設定を追加する
$ cd /path/to/document-root/sites/default
$ vim ../development.services.yml
〜以下の行を追加する
parameters:
http.response.debug_cacheability_headers: true
twig.config:
debug: true
auto_reload: true
cache: false

■ settings.php から settings.local.php を読み込むようにする
$ cd /path/to/document-root/sites/default
$ vim setting.php
$ diff -upN default.settings.php settings.php

-# if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
-# include $app_root . '/' . $site_path . '/settings.local.php';
-# }
+if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
+ include $app_root . '/' . $site_path . '/settings.local.php';
+}

■ Cacheをクリアする
$ drush cr

ページ

OTHER FAQ

Drupal開発・運用の疑問/質問の答えはここに

無料ユーザー登録すると質問できます。

カテゴリ Core Ver. 関連モジュール タイトル降順で並び替える
Proxy 7.59 Proxy Apache settings.php リバースプロキシ(Apache)+バックグランドWeb(Drupal 7 )でログインセッションを維持する方法
テーマ 7.56 field レンダリング配列内に「ラベル非表示」を指定する方法
ユーザ 7.34 ip_ranges ログインアタック対策は?
コンテンツの管理 7.15 Pagenation 一つの長いページをBookなどのように連続して読ませることはできますか?
コンテンツの作成 7.38 node 代理投稿を可能にしたい
ユーザ 7.44 Quickbar 会員の種別(役割)別にメニューを設けたい
ブロック 7.23 伸縮するfieldsetブロックを追加したい
コンテンツの作成 7.26 Form Ajax 入力フォームで#ajax使用時、#default_valueを書き換えても反映しない
サイトの構築 7.38 deployment 冗長構成におけるアップロードおよび時間指定公開について
コンテンツの管理 8.9.x 写真の変更を行いたい
video 8.4x video map 動画上にクリッカブルマップを作成する方法
フォーム 7.34 Webform 動的なフォーム(webform)
言語 7.15 Entity Translation 各フィールドのラベルの多言語切り替え漏れ(フィールド・ラベル)
言語 7.14 Entity Translation 各フィールドのラベルの多言語切り替え漏れ(接頭子、接尾子)
言語 6.x i18n 多言語対応サイトのサイト名やスローガン/ミッションなどを多言語化する方法を教えてください
コンテンツの管理 7.16 PHP 好きなところにノードを埋め込みたい
フォーム 7.15 DefaultTextForNode 新しいページの作成方法を一から教えてください
コンテンツの作成 8.4x node 新規ノードを作成する
コンテンツの作成 7.34 Entityreference prepopulate 新規ノード作成時のリファレンス方法
ユーザの管理 7.27 PHP 新規ユーザーの追加ができない

ページ