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. 関連モジュール タイトル
コンテンツの作成 7.38 Webform Webformでテーブル形式にしたい
コンテンツの作成 8.4x archiver zipファイル圧縮・解凍する方法
コンテンツの作成 7.38 node 代理投稿を可能にしたい
コンテンツの作成 8.9.x vim nkf ファイルのエンコーディングを確認、変更する方法
コンテンツの作成 7.26 PHP ノード内の一部(フィールド)を変更する
コンテンツの作成 7.15 Darty Form 編集ページでの操作ミス
コンテンツの作成 7.34 CCK ノード入力フォームへパラメータを渡す
コンテンツの作成 7.34 Entityreference prepopulate 新規ノード作成時のリファレンス方法
コンテンツの作成 8.9.x CSS キャプション付きの(右寄/左寄)画像を画像サイズを基準にきれいに表示する方法
コンテンツの作成 7.15 Form API Validation フォームの入力内容を細かくチェックしたい
コンテンツの作成 6.x Insert Block ブロックの内容を本文中に表示するには?
コンテンツの作成 8.4x コンテンツ作成時のフォームレイアウトの変更
コンテンツの作成 7.31 CKEditor CKEditorの新規生成ダイアログ内の初期値の変更
コンテンツの作成 7.38 CKEditor CKEditorの「ソース」に入力したタグが消える
コンテンツの作成 8.4x PhpSpreadsheet Excelを読み書きする方法
コンテンツの作成 7.38 node form ノード編集フォームをテーブル表示形式にしたい
コンテンツの作成 7.26 CKEditor Views Viewsでティザーを一覧するとページのレイアウトが崩れることがある
コンテンツの管理 8.6.x Commerce Commerce orderからすべての商品名を取得する方法
コンテンツの管理 7.50 Administration menu 標準のユーザー管理ページ
コンテンツの管理 7.16 PHP 好きなところにノードを埋め込みたい

ページ