[Drupal] How to migrate Drupal 7 themes to Drupal 8 ?

By | 30th Jun 2015 | 2 min read

In Drupal 8, .info file is converted to .info.yml file. It is a symphony component. The .info.yml file contains the metadata about your theme, such as theme name, description, version of the Drupal it supports, and type. Type is new metadata type indicate type of the extension such as module, theme etc.

Writing themename.info.yml is the first step when focusing Drupal theme development. Use same name for the file and for the theme directory.

We now use YAML-formatted .info.yml files. The format is very similar to the Drupal7 .info files:

name: theme name
type: theme
description: 'describe about your theme'
core: 8.x

This file write in themes/themename/ folder. In drupal 8"=" is change to " : "

Information stored in all .info.yml files:

  • name: The real name of the module for display purposes. (Required)
  • description: A brief description of the module.
  • type: whether it is for a module or theme. (Required)
  • core:The supporting Drupal version for which your theme is made. For Drupal 8 this would be 8.x, etc.

stylesheets:

# Add a new CSS file:
stylesheets:
  all:
    - layout.css
# Override a CSS file:
stylesheets-override:
  - system.theme.css

# Remove a CSS file:
stylesheets-remove:
  - node.css

In Drupal 8 use a hyphen and a space to define a list element. The CSS files added through the info.yml file when loading every page where the theme is active. Drupal 8 introduces separate properties in theme .info.yml file which enables adding, overriding, and removing stylesheets. Our Drupal Migration Services help to migrate to a higher version, which also ensures safe switching of your website framework.