from shutil import copytree, rmtree

from foliant.utils import spinner
from foliant.backends.base import BaseBackend


class Backend(BaseBackend):
    '''Backend that just applies its preprocessors and returns a project
    that doesn't need any further preprocessing.
    '''

    targets = 'pre',

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._preprocessed_dir_name = f'{self.get_slug()}.pre'

    def make(self, target: str) -> str:
        rmtree(self._preprocessed_dir_name, ignore_errors=True)
        copytree(self.working_dir, self._preprocessed_dir_name)

        return self._preprocessed_dir_name

@@ -408,22 +408,150 @@
 sed_
-dir_name = f'%7B
+config = self.config.get('backend_config', %7B%7D).get('pre', %7B%7D)%0A%0A        self._preprocessed_dir_name = f'%7Bself._preprocessed_config.get(%22slug%22, 
 self
@@ -561,16 +561,17 @@
 t_slug()
+)
 %7D.pre'%0A%0A

Allow to override the top-level slug.