I still a bit new to D8 and loving the new configuration management system that has replaced Features.

I am looking for the best technique for containing particular configurations in my custom modules.

I have a node type called quiz and a module called quiz_module. By default, when I execute drush cex -y the output yaml files are deposited into ../config/sync.

Is it the correct thing to do to move all the yaml files relating to the quiz node type in to my quiz_module? When do that, the same files are recreated whenever I execute drush cex -y.

To counter that duplication, I created a softlink of the files from quiz_module to '../config/sync' but that didn't seem to update the yaml files as I expected.

Any help, please?

  • Is this so that when you install the module on another site it would create your content types/fields? If so take a look at drupal.org/docs/8/creating-custom-modules/… But if you're trying to just move part of the config export/import into multiple folders then you can't really. It all needs to be together in your specified sync folder
    – Leigh
    Aug 30, 2019 at 14:36
  • @Leigh: Yes, both your points. I had already read the article you suggested. However, according to what you said, it sounds like a D8 project needs to version control the entire sync directory and also have a separate git repo for the custom modules directory? I could be mistaken but there's almost no reason to create custom modules.
    – sisko
    Aug 30, 2019 at 15:31
  • This isn't quite true. You can use the Config Split to split configuration into multiple directories, but I don't think that's really what you'd want here. There's still a reason to create custom modules, they're just no longer the way you should deploy your configuration for a site.
    – sonfd
    Aug 30, 2019 at 15:37
  • 1
    You can use my answer from this post, I had the same “problem”, drupal.stackexchange.com/q/284865/72672.
    – user72672
    Aug 30, 2019 at 15:41

2 Answers 2


Configuration Management did not replace Features completely, Features still has its place.

My understanding is that:

  • Configuration Management should be used to manage your configuration for a specific site/project.
  • Features should be used to export configuration to custom modules as you develop them if they're going to be re-used on another site.

The configuration in your custom module goes into 2 directories (install or optional).

  • Configuration in the install directory is considered required and only gets imported when your module is installed.
  • Configuration in the optional directory is optional and will import during your module install if all the dependencies are present. (I think it also gets imported if all dependencies are later installed.) E.g. If you define a View in your module's optional directory, that configuration would be installed only in two instances: 1. when you install your module, if Views is installed, or 2. when Views is installed later, sometime after your module is installed.

The Features module page lists several additional resources to help understand the differences between Configuration Management and Features.


The most efficient way to move a content type into a custom module is from the command line:

drupal config:export:content:type page \
  --module="demo" \
  --optional-config \
  --remove-uuid \

Source: https://drupalconsole.com/docs/en/commands/config-export-content-type

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.