You do not need to import every change into CoreMedia Content Server for your daily work. Importing is only required when you create a new theme and when you add or delete web resources from your theme. That is because the linked resources in the Content Server have to correspond to your local resources.
The integrated Blueprint workflow for theme import requires the following Maven plugins:
- frontend-maven-plugin
This plugin (see https://github.com/eirslett/frontend-maven-plugin) is used to integrate Node, NPM and tools such as Grunt, Bower, Gulp into your Maven workflow. The plugin uses Grunt to build your Saas resources and to put the Freemarker templates into a JAR file.
- maven-assembly-plugin
This plugin puts all generated web resources into a Zip file and also adds the theme descriptor to the file.
- coremedia-webresource-content-maven-plugin
This plugin (see https://documentation.coremedia.com/utilities/coremedia-webresource-content-maven-plugin/ for details) creates CoreMedia XML conform content from your web resources. This content is ready for the import into the Content Server.
In short, the Blueprint workflow consists of the following steps:
You edit the native web resources in a theme. See Section 6.4.1, “CoreMedia Themes” for details.
You build the theme with the frontend-maven-plugin or use directly Grunt (see the
README.md
file, in thecorporate-theme
extension).The web resources are bundled into Zip artifacts with the maven-assembly-plugin in the theme modules.
The coremedia-webresource-content-maven-plugin takes the themes artifact and creates CoreMedia XML conform content.
Afterwards, you can use the serverimport tool (see Section 3.14.2.12, “Serverimport/Serverexport” in CoreMedia Content Server Manual for details) to import the content into the Content Server.
When you have imported the theme for the first time, you have to link it to the appropriate site. You can do this in CoreMedia Studio.
The following sections describe these tasks in more detail:
Building and Packaging the Web Resources
The theme is build with Grunt. Either directly started, or with the maven-frontend-plugin. When you want to add the
templates to the theme, you have to start the plugin with the withTemplates
profile.
Grunt is configured in the Gruntfile.js
file. Mainly, Grunt processes the Saas files and copies them together with the other resources into
the target/resources/themes
folder. The Freemarker templates are packaged into a JAR file and also
copied into the target folder.
As a second step, the maven-assembly-plugin takes the web resources from the target directory and packs them into a Zip file. It also adds the
theme descriptor into the THEME-METADATA
folder of the Zip file. The configuration of the maven-assembly-plugin is taken
from the assembly/resources-assembly-descriptor.xml
file.
Note | |
---|---|
The Maven build process also creates a theme JAR file which contains the templates, directly below the |
Converting web resources into content items
Before you can import web resources into the CoreMedia repository, you have to convert them into an XML format that can be imported. CoreMedia Blueprint contains the coremedia-webresource-content-maven-plugin for this task (see https://documentation.coremedia.com/utilities/coremedia-webresource-content-maven-plugin/ for details).
When configured, the plugin processes the web resources of all dependencies with type "zip" and classifier "theme" automatically during the Maven build and produces XML content ready to be imported with the serverimport tool. The content files are bundled into another Zip artifact.
Configure the plugin in your POM file as follows:
<dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>MyTheme</artifactId> <version>${project.version}</version> <classifier>theme</classifier> <type>zip</type> </dependency> </dependencies> <build> <plugins> <!-- Create Webresource content in target folder --> <plugin> <groupId>com.coremedia.maven</groupId> <artifactId>coremedia-webresource-content-maven-plugin</artifactId> <dependencies> <!-- Provide the CSS importer implementation and its configuration--> <dependency> <groupId>${project.groupId}</groupId> <artifactId>css-importer-lib</artifactId> <version>${project.version}</version> </dependency> <!-- Provide doctypes to create web resources as content--> <dependency> <groupId>${project.groupId}</groupId> <artifactId>contentserver-blueprint-component</artifactId> <version>${project.version}</version> </dependency> </dependencies> <executions> <execution> <id>compile-resource-corporate-testdata</id> <goals> <goal>compile</goal> </goals> <phase>compile</phase> </execution> </executions> </plugin> </plugins> </build>
Example 6.17. Configuration for webresources plugin
The module in which you execute the plugin requires a dependency on your theme artifact. The plugin itself requires a dependency on CoreMedia content types. However, the plugin is only capable of the CoreMedia Blueprint document types. Even though the dependency to the document types might look generic, it is needed only for technical reasons. That is because the plugin makes use of a temporary content server internally.
CoreMedia Blueprint comes with some test-data
modules which provide the content of the CoreMedia example sites.
In the default configuration, these modules include the themes content for input.
Even though presumably you do not maintain any articles and pictures in the project workspace, you should add a content module to your project right now, because it also serves as hook point to include the themes. You might use a content module for some initial content like technical settings, symbols and the like.
Importing content into Content Server
When the coremedia-webresource-content-maven-plugin has created XML content, import the content into the Content Server. For the local Chef deployment, this is integrated in the deployment workflow. So, when you have integrated the content creation into an existing content module as described above, your theme will automatically be imported, when you create or update your Vagrant box.
Warning | |
---|---|
Content of type |
When you want to import the content manually, using the serverimport tool, have a look in Section 3.5.3, “Locally Starting the Components”. You will find a description on how to import content from the workspace into the server. In Section 3.14.2.12, “Serverimport/Serverexport” in CoreMedia Content Server Manual you will find more details about the serverimport tool.
Linking
After importing the web resources, they are available on your CoreMedia Content
Server below the Themes
folder. If you added new web resources, you have to link them to the root page
of a site (see Section 6.3.12, “Client Code Delivery”). To do this, you
can use CoreMedia Studio or CoreMedia Site
Manager. If you just changed an existing web resource and do not want to change
linking you can skip this step.
To link the theme, proceed as follows:
Open the Page to which you want to add the theme in CoreMedia Studio.
Open the System tab.
Link the aggregating
CSS
andJavaScript
files from the main folder of the theme to the Associated CSS and Associated JavaScripts properties respectively (see Figure 6.25, “ Linking a theme to site root ”).