Конфигурация преобразователя зависимостей
CMS Studio упрощает извлечение и мониторинг зависимостей между элементами контента, помогая авторам контента в публикации, управлении рабочими процессами и выполнении основных операций с контентом, таких как копирование и удаление. В файле конфигурации преобразователя зависимостей определены пути к файлам, которые DC распознает как зависимости, а также указано, как они должны быть извлечены.
Чтобы внести изменения в конфигурацию преобразователя зависимостей:
1. В боковой панели нажмите на Инструменты сайта.
2. Перейдите в Конфигурация > Конфигурация преобразователя зависимостей.
Образец файла конфигурации
Ниже расположен пример конфигурационного файла преобразователя зависимостей:
<?xml version="1.0" encoding="UTF-8"?>
<!-- resolver-config.xml
This file configures what file paths CMS considers a dependency and how they should be extracted
-->
<dependency-resolver>
<item-types>
<item-type>
<!-- name of type -->
<name>page</name>
<!-- how to identify items of this type -->
<includes>
<!-- path pattern regexes (multiple) -->
<path-pattern>/site/website/.*\.xml</path-pattern>
</includes>
<!-- how to find dependencies in these items -->
<dependency-types>
<dependency-type>
<name>page</name>
<includes>
<pattern>
<find-regex>/site/website/([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>component</name>
<includes>
<pattern>
<find-regex>/site/components/([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>item</name>
<includes>
<pattern>
<find-regex>/site/(?!website/|components/)([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>asset</name>
<includes>
<!-- path patterns to look for (multiple) -->
<pattern>
<find-regex>/static-assets/([^<"'\)\?\#]+)</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>rendering-template</name>
<includes>
<pattern>
<find-regex>/templates/([^<"]+)\.ftl</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>script</name>
<includes>
<pattern>
<find-regex>/scripts/([^<"]+)\.groovy</find-regex>
</pattern>
<pattern>
<find-regex><content-type>/(.*)/(.*)</content-type></find-regex>
<transforms>
<transform>
<match><content-type>/(.*)/(.*)</content-type></match>
<replace>/scripts/$1s/$2.groovy</replace>
</transform>
</transforms>
</pattern>
</includes>
</dependency-type>
</dependency-types>
</item-type>
<item-type>
<!-- name of type -->
<name>component</name>
<!-- how to identify items of this type -->
<includes>
<!-- path pattern regexes (multiple) -->
<path-pattern>/site/components/([^<]+)\.xml</path-pattern>
</includes>
<!-- how to find dependencies in these items -->
<dependency-types>
<dependency-type>
<name>page</name>
<includes>
<pattern>
<find-regex>/site/website/([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>component</name>
<includes>
<pattern>
<find-regex>/site/components/([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>item</name>
<includes>
<pattern>
<find-regex>/site/(?!website/|components/)([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>asset</name>
<includes>
<pattern>
<find-regex>/static-assets/([^<"'\)\?\#]+)</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>rendering-template</name>
<includes>
<pattern>
<find-regex>/templates/([^<"]+)\.ftl</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>script</name>
<includes>
<pattern>
<find-regex>/scripts/([^<"]+)\.groovy</find-regex>
</pattern>
<pattern>
<find-regex><content-type>/(.*)/(.*)</content-type></find-regex>
<transforms>
<transform>
<match><content-type>/(.*)/(.*)</content-type></match>
<replace>/scripts/$1s/$2.groovy</replace>
</transform>
</transforms>
</pattern>
</includes>
</dependency-type>
</dependency-types>
</item-type>
<item-type>
<!-- an item is content that is not a page nor a component -->
<name>item</name>
<!-- how to identify items of this type -->
<includes>
<!-- path pattern regexes (multiple) -->
<path-pattern>/site/(?!website/|components/).*\.xml</path-pattern>
</includes>
<!-- how to find dependencies in these items -->
<dependency-types>
<dependency-type>
<name>page</name>
<includes>
<pattern>
<find-regex>/site/website/([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>item</name>
<includes>
<pattern>
<find-regex>/site/(?!website/|components/)([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>component</name>
<includes>
<pattern>
<find-regex>/site/components/([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>item</name>
<includes>
<pattern>
<find-regex>/site/(?!website/|components/)([^<]+)\.xml</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>asset</name>
<includes>
<pattern>
<find-regex>/static-assets/([^<"'\)\?\#]+)</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>rendering-template</name>
<includes>
<pattern>
<find-regex>/templates/([^<"]+)\.ftl</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>script</name>
<includes>
<pattern>
<find-regex>/scripts/([^<"]+)\.groovy</find-regex>
</pattern>
<pattern>
<find-regex><content-type>/(.*)/(.*)</content-type></find-regex>
<transforms>
<transform>
<match><content-type>/(.*)/(.*)</content-type></match>
<replace>/scripts/$1s/$2.groovy</replace>
</transform>
</transforms>
</pattern>
</includes>
</dependency-type>
</dependency-types>
</item-type>
<item-type>
<!-- name of type -->
<name>asset</name>
<!-- how to identify items of this type -->
<includes>
<!-- path pattern regexes (multiple) -->
<!-- include only textual files that can be scanned -->
<path-pattern>/static-assets/([^<"'\)]+)\.css</path-pattern>
<path-pattern>/static-assets/([^<"'\)]+)\.js</path-pattern>
<path-pattern>/static-assets/([^<"'\)]+)\.html</path-pattern>
<path-pattern>/static-assets/([^<"'\)]+)\.xml</path-pattern>
<path-pattern>/static-assets/([^<"'\)]+)\.json</path-pattern>
<path-pattern>/static-assets/([^<"'\)]+)\.scss</path-pattern>
<path-pattern>/static-assets/([^<"'\)]+)\.sass</path-pattern>
<path-pattern>/static-assets/([^<"'\)]+)\.hbs</path-pattern>
</includes>
<!-- how to find dependencies in these items -->
<dependency-types>
<dependency-type>
<name>asset</name>
<includes>
<!-- path patterns to look for (multiple) -->
<pattern>
<find-regex>/static-assets/([^<"'\)\?\#]+)</find-regex>
</pattern>
</includes>
</dependency-type>
</dependency-types>
</item-type>
<item-type>
<!-- name of type -->
<name>rendering-template</name>
<!-- how to identify items of this type -->
<includes>
<!-- path pattern regexes (multiple) -->
<path-pattern>/templates/([^<"]+)\.ftl</path-pattern>
</includes>
<!-- how to find dependencies in these items -->
<dependency-types>
<dependency-type>
<name>asset</name>
<includes>
<!-- path patterns to look for (multiple) -->
<pattern>
<find-regex>/static-assets/([^<"'\)\?\#]+)</find-regex>
</pattern>
</includes>
</dependency-type>
<dependency-type>
<name>rendering-template</name>
<includes>
<pattern>
<find-regex>/templates/([^<"]+)\.ftl</find-regex>
</pattern>
</includes>
</dependency-type>
</dependency-types>
</item-type>
<item-type>
<!-- name of type -->
<name>script</name>
<!-- how to identify items of this type -->
<includes>
<!-- path pattern regexes (multiple) -->
<path-pattern>/scripts/([^<"]+)\.groovy</path-pattern>
</includes>
<!-- how to find dependencies in these items -->
<dependency-types>
<dependency-type>
<name>script</name>
<includes>
<!-- path patterns to look for (multiple) -->
<pattern>
<find-regex>import scripts.(.*)</find-regex>
<transforms>
<transform>
<match>(.*)</match>
<replace>$1</replace>
</transform>
</transforms>
</pattern>
</includes>
</dependency-type>
</dependency-types>
</item-type>
</item-types>
</dependency-resolver>