Intuition

When setting up a new Drupal site, one of the key tasks is configuring the theme to suit your design and content needs. Paragraphs, a popular module in Drupal, allows you to create flexible and reusable content components, and is used extensively in many of the projects.

2025-08-06T090423

Althought we could adhere the look of the pargraph through preserving the paragraph--xxyyzz.html.twig file, the configuration including ranging from the machine name, help text, fields, views, are not captured in the paragraph--xxyyzz.html.twig file, and require some effort to setup from the Drupal backend. Hence if we could include those as a part of the sub-theme’s configuration to be installed with the theme, this could save the devs heaps of time.


Steps to Export Paragraph Configurations

Method 1: Drush Command

2025-08-06T091139

  1. First export of the Drupal configuration via drush config:export to save the status before the change

    Then configure your new paragraph type, add fields, configure views, …

  2. Second export of the configuration via the same command to save the status after the change happens

    Then look carefully to identify which configurations are relevant to the paragraph change you’ve made (for the screenshot example, only the configuration containing the keyword paragraph and card are relevant)

  3. Use cp command to copy the releevant yml files to the theme’s config/install folder. The -i flag will prompt user when attempting to override an existing file (example of such command could be found here: exmaple_cp_script.txt)

(*if you are familiar with the names of the yml configuration files, you could skip to the last step)

Method2: GUI Interface

2025-08-06T095749

  1. Navigate to Configuration > Configuration Synchronization > Export.
  2. Select Single Item and choose from the configuration type. (You’ll need to export Paragraph, Field, View one by one)
  3. Copy the configuration content and save to files with the instructed filename.

Outcome

From the below video, the importing the configuration files in theme_name/config/install file is automatically performed as a part of the installation process of the subtheme. As a result the two paragraph types card and toc are automatically created.

2025-08-06T094112


Reference