Git Configurations

Pull with Rebase

Git push with rebase instead of “merge”.

git config --global pull.rebase true

Push only to the current branch.

If its named upstream is identical

git config –global push.default simple


Drupal theme

Create the theme

1. Create a theme file in:
2. Add content to your theme file:
name: Beautiful theme
type: theme
base theme: classy
description: 'A great theme for warm summer days.'
package: Custom
core: 8.x
Extra: Key/value pairs in
name (required)
type (required)
description (optional)
package (optional)
core (required)
php (optional)
version (optional)
libraries (optional)
libraries-override (optional)
libraries-extend (optional)
base theme (recommended)
hidden (optional)
engine (optional)
logo (optional)
screenshot (optional)
regions (optional)
regions_hidden (optional)
features (optional)
stylesheets-remove (deprecated)
ckeditor_stylesheets (optional)
  • Theme naming: name_with_underscore is required by drupal.
  • Tabs are NOT allowed. Use spaces ONLY.
  • Properties and lists MUST be indented by two (2) spaces.
  • drush cr is required after the changes, is clean all the cache.

Structrue of Drupal Project

Drupal root 
+-- core
|   +-- themes
|       +-- bartik
|       +-- classy
|       +-- engines
|       +-- seven
|       +-- stable
|       +-- stark
+-- sites
|   +-- *
|       +-- themes
|           +-- maya
+-- themes
    +-- contrib
        +-- zen        
    +-- custom
        +-- my_custom_theme

Structrue of Theme

Theme root 
+-- assets
+-- src
+-- templates
|   +-- block
|   +-- content
|   +-- field
|   +-- form
|   +-- icons
|   +-- layout
|   |     -- html.html.twig
|   +-- ...and more
  • is required.
  • theme_name.theme is a PHP file that contains conditional logic, and handles preprocessing of variables before they are output via template files.
  • templates/*.html.twig is used to override the base twig template files.
  • theme_name.libraries.yml define CSS and JavaScript libraries that can be loaded by your theme. All CSS and JavaScript should be added to the page via an asset library.