Skip to content

coremedia-contributions/blueprint-svg-support

Repository files navigation

CoreMedia Content Cloud Version Status

SVG Support for CoreMedia Blueprint

This extension adds SVG support to the CoreMedia Blueprint.


Installation

The extension can be installed in your Blueprint workspace in two ways. Either by adding this repository as a Git submodule or by copying the code directly. The recommended approach is to add the extension as a Git submodule.

Install Option A - Git Submodule

Add this repository or your fork as a Git submodule to your existing CoreMedia Blueprint workspace in the modules/extensions folder.

This way, you will be able to merge new commits made in this repo back to your fork.

From the project's root folder, clone this repository as submodule into the modules/extensions folder. Make sure to use the branch name that matches your workspace version.

git submodule add https://github.com/coremedia-contributions/blueprint-svg-support.git modules/extensions/svg

Use the extension tool in the root folder of the project to link the modules into your workspace.

mvn -f workspace-configuration/extensions extensions:sync -Denable=svg

Install Option B - Code Copy

Download a copy of this repository and extract the files into your Blueprint workspace to modules/extensions/svg.

Frontend Code

This repository also contains a custom brick that needs to be added to your frontend. Add a reference to the svg-support brick to the frontend/workspace.yaml.

packages:
  ...
  - '../modules/extensions/svg/frontend/bricks/svg-support'

Afterwards you can include the brick in your theme by adding the following dependency in the theme package.json.

"@coremedia/brick-svg-support": "^1.0.0",

Upload Configuration

If an CMSVG content should be created, when business users upload SVG files in Studio, you need to adapt the UploadSettings (/Settings/Options/Settings/UploadSettings) by adding/adjusting the following mapping:

<StructProperty Name="mimeTypeMappings">
  <Struct>
    ...
    <StringProperty Name="image/svg+xml">CMSVG</StringProperty>
  </Struct>
</StructProperty>

For more details, please consult the section 6.1.14 Upload Files in the Blueprint Developer Manual.