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. 関連モジュール タイトル降順で並び替える
テーマ 8.3x Contribute themes drupal8-寄贈テーマの動向
拡張機能 8.3x Contribute modules drupal8-寄贈モジュールの動向
Viewsプログラミング 8.4x Views drupal8におけるViewsプログラミング
サイト情報 8.9.x api Drupal::request() メモ
チューニング 7.26 PHP DrupalはNginxで動く?
サイトの構築 8.9.x Webform drupalを使用した登録、一覧表示の方法について
PHP 8.9.x drush drush sql:cli < が機能しない場合の対処
アップデート 7.34 Distribution(Commerce Kickstart) drushでcommerce_kickstartのアップデートに失敗する
drush 7.54 Drush Drushでdrupalサイトをインストールする方法
サイトの構築 7.34 ECK Entityの使い方について
コンテンツの管理 8.4x Entity EntityをPropertyで探す(クエリする)方法
コンテンツの作成 8.4x PhpSpreadsheet Excelを読み書きする方法
表示 7.34 Views Infinite Scroll Facebookページのようにスクロールするとコンテンツが追加されるようなコントロール
フォーム 8.9.x api GET/POSTされた情報を得る方法
Gmian 8.8.x Gmail Gmail:外部メールサーバー経由のメール送信ができなくなった場合の対処方法
Google 7.38 robots.txt Google Search Console Teamから「CSS および JS ファイルに Googlebot がアクセスできません」
Initial 8.4x Subscriber hook_init() 〜 drupal_goto() を drupal8でやる方法
GoogleMaps 7.28 Javascript IE9でGoogle Map APIを利用した住所情報所得がうまくゆかない
サイト情報 8.4x JavaScript JavaScriptに変数を渡す方法
jQuery Revolution 7.50 jQuery Revolutionのリンクがスマホで機能しない

ページ