Skip to content
Product Documentation

Upgrade to v2 Arc Blocks

The following sections step through the configuration to get you setup with Arc Blocks v2.

1. Configure Feature Pack

This guide provides the steps to configure your feature pack for Blocks v2.

You can also view the Themes starter repo in our Arc XP Github organization:

For compatible node, npm, and Engine versions to use with Themes versions, see How to run PageBuilder Engine locally - Local Environment.

blocks.json

themesReleaseVersion has already been an available configuration option, to get the correct version you’ll need to update this value to the latest 2.x.x version.

themeComponents is a new key which will enable the usage of the arc-themes-components React components for you to construct your own custom blocks with. theme is a new key that defines which OOTB styles will be applied by default.

"themesReleaseVersion": "arc-themes-release-version-2.4.1",
"themeComponents": "@wpmedia/arc-themes-components",
"theme": "news",

All engine-theme-sdk imports must be removed from your bundle in order to succesfully upgrade to v2. The import can also be removed from the blocks.json:

"engineSDK": "@wpmedia/engine-theme-sdk",

We’ve shifted most of engine-theme-sdk over to to arc-themes-components, these imports should be a direct swap. You can continue to include in your blocks.json while you work on updating imports. Check the Deprecated Libraries and Change Log Summary to review the changes from engine-theme-sdk to arc-themes-components. If any imports have changed you will have errors when running your local environment until they are resolved.

Our recommendation when converting old engine-theme-sdk imports is to cherry-pick the styles and components as-needed. Porting over all of the old v1 theme styles is more challenging and can cause compile issues.

There are several new blocks to be included in your blocks array. These need to be included for local development, but do not need to be added to anywhere in the site itself.

"blocks": [
...
"@wpmedia/alias-tokens",
"@wpmedia/breakpoint-tokens",
"@wpmedia/global-phrases-block",
"@wpmedia/global-tokens",
"@wpmedia/signing-service-content-source-block"
],

You likely have a /resizer url defined by site or a default in blocks.json which will need /v2/ append

"resizerURL": "/resizer/v2/"

Toggle for blocks styling functionality (required setup to use our design system)

Should you choose to import your own styling system and not utilize our styling compiler, you have the ability to toggle it on/off. By default, styles compiling will be turned off. To use our styles compiling, add the following to your blocks.json file:

"buildSiteStyles": true,

environment/*.json

New environment variables for the latest image resizer will need to be added to your environment .json files. As well as a siteStyles object that should contain your site ID with the site ID you want the styles mapped to as the value. For a single site, this will be a one-to-one mapping.

"RESIZER_TOKEN_VERSION": "[check the delivery API for current value]",
"SIGNING_SERVICE_DEFAULT_APP": "resizer",
"siteStyles": {
"daily-intelligencer": "daily-intelligencer"
}

For multi-site, this enables you to define one-to-many styles. Meaning you could have one set of styles applied to multiple sites. Like in this case, daily-intelligencer and the-gazette would both have the same styling applied to their blocks while karc would have it’s own.

"siteStyles": {
"daily-intelligencer": "daily-intelligencer",
"the-gazette": "daily-intelligencer",
"karc": "karc"
}

package.json

Update your Arc Fusion CLI to the latest vresion.

Terminal window
npm install --save-dev @arc-fusion/cli@latest

Use at least @2.1.0

Terminal window
npm install --save-dev @arc-fusion/cli@2.1.0

2. Set up Design System

This section helps you setup the Block Design System with your own tokens.

Because you’re on a feature pack that wasn’t initialized with the expected design system structure, you must create the themes folder and files and optionally sync to the latest tokens and pull in a block’s styles.

The root of your arc-themes-feature-pack must include:

|-- themes
|-- styles
|-- alias.json
|-- blocks.json
|-- breakpoints.json
|-- components.json
|-- global.json

And for multi-site usage, you can add an optional sites folder to add site-specific styles:

|-- themes
|-- sites
|-- site1
|-- alias.json
|-- blocks.json
|-- breakpoints.json
|-- components.json
|-- global.json
|-- site2
|-- alias.json
...

See How to Design for Arc XP Themes.

Script Setup

First let’s add a script to make this easier. From the root of your feature pack folder, run:

touch arc-themes.js

Copy the following code into the arc-themes.js file:

Add "arc-themes": "node arc-themes.js" to your package.json to make it easy to execute.

{
"scripts": {
...
"arc-themes": "node arc-themes.js"
}
}

Now you can run the script using the following commands.

Initialize Folder Structure

To initialize the folder structure, run:

Terminal window
npm run arc-themes -- init

Or for multi-site clients, run the following command using the site IDs that you would like to initialize in your themes/sites folder:

Terminal window
npm run arc-themes -- init --sites site1,site2,site3

Pull Tokens

To all of the out-of-the-box breakpoints, alias tokens, and global tokens, run:

Terminal window
npm run arc-themes -- get-tokens --theme news --version 2.4.1

Or if you’d like to pull the tokens into one of your site folders, run:

Terminal window
npm run arc-themes -- get-component-styles --component button --theme news --version 2.4.1 --site site1

Pull Component Styles

To get the styles for a specific component such as button, run:

Terminal window
npm run arc-themes -- get-component-styles --component button --theme news --version 2.4.1

Or if you’d like to pull the component styles into one of your site folders, run:

Terminal window
npm run arc-themes -- get-component-styles --component button --theme news --version 2.4.1 --site site1

Pull Block Styles

To get the styles for a specific block such as card-list-block, run:

Terminal window
npm run arc-themes -- get-component-styles --component button --theme news --version 2.4.1 --site site1

Or if you’d like to pull the block styles into one of your site folders, run:

Terminal window
npm run arc-themes -- get-styles --block card-list-block --theme news --version 2.4.1 --site site1

The above command is useful if you’ve previously ejected out of an Arc block to apply your own custom styling or have done custom style overrides, this gets you scaffolded out to begin setting the styles you want with the out-of-the-box block again.

Keep in mind if it’s ejected and you removed it from your blocks.json, you’d need to re-add it to your blocks.json array.

If it was custom style overrides but you kept the Arc block installed, you’ll just need to begin transferring them over into the styles object.

3. Migrate to Resizer V2

Coinciding with Themes 2.0, we are moving to a newer version of Arc XP Image Resizer (V2) as part of the continuous improvement efforts of our global SaaS platform. Key changes include moving to a more powerful and reliable option resizing service and the ability for you to add SEO-friendly names for images, which can help your site’s SEO performance. Additionally, with the new Resizer, the authentication token is included in the image ANS and is good for all resize variations, so you won’t have to worry about storing the secret key.

After you upgrade to Themes 2.0, the images in all blocks are fully migrated to Image Resizer V2. However, it is important to note specific image components and blocks deprecations that may require updating during your upgrade to Themes 2.0.

For custom content sources that you’ve built, refer to the Arc XP Learning Center - How to migrate from Resizer V1 to V2: User Guide.

4. Convert Custom Blocks

In Themes 2.0, there are cases where you have custom blocks that you want to convert to using the Themes Design System or there is a change released that requires you to adapt your custom code.

Blocks Styling

In cases where you’ve applied custom style overrides or ejected out of an Arc block only to set your own styling. You can update your themes/blocks.json with the blocks and style changes you need.

Refer to the Basics: Blocks guide.

Blocks Styling Using Logical Properties

With the update to support right-to-left languages, blocks now uses CSS logical properties. These properties will conflict with older, physical and shorthand CSS properties causing unexpected results. If you are using custom styling in your blocks, some updates will need to be made, such as using inline-size and max-inline-size, instead of width and max-width. For the full list of CSS logical properties and their older equivalents, see CSS logical properties and values.

arc-themes-feature-pack/themes/styles/blocks.json
{
"byline": {
"styles": {
"default": {
"font-size": "$body-font-weight-small",
"line-height": "$body-line-height-tiny",
"components": {
"link": {
"text-decoration": "green wavy underline"
},
"link-hover": {
"text-decoration": "green dashed underline"
}
}
},
"desktop": {}
}
}
}

Deprecated Libraries

@wpmedia/engine-theme-sdk and @wpmedia/shared-styles had components, functions, and utilities available to construct your own custom blocks. Most of these have been shifted into the @wpmedia/arc-themes-components package as a direct replacement.

If you are importing utilities, components, or functions from engine-theme-sdk or shared-styles, refer to the following lists to identify which can be converted to importing from @wpmedia/arc-themes-components and which are deprecated where you must replace the import with your own code or copy the deprecated import into your own codebase as custom code to continue using it.

Deprecated Packages

Below is a list of all exports from our deprecated engine-theme-sdk and shared-styles libraries, indicating if there is library they’ve been migrated to and if the 2.0 implementation is a direct replacement (meaning you can just change the library imported from). If the Direct Replacement column is “TRUE”, it is a direct swap to the new library with no code update. There is also a Github link when the replacement exists, or an example of the component used on a block.

@wpmedia/blocks (including image components)

@wpmedia/shared-style

@wpmedia/engine-theme-sdk

@wpmedia/news-theme-css

news-theme-css is not used by any Arc Block in Themes 2.0, and the Arc Themes Design System is replacing the need for the @wpmedia/news-theme-css dependency. With this release of Themes, there is greater flexibility to define your own global CSS variable tokens and aliases through the Arc Themes Design System, as well as applying targeted block styling to every Arc Block. The dependency is no longer included when deploying with Theme Settings and it does not need included in your blocks.json when developing locally. The removal of these dependencies reduces unnecessary CSS in your bundle.

DeprecatedNew LibraryReference LinkReplacementDirect ReplacementMigration Note
LinkedBackgroundHover@wpmedia/arc-themes-components- pill
- link
PillFALSEThe Pill component will render in span for use with backgrounds. If an href is passed as a property, the Pill will render as a simple hyperlink for internal navigation, and is not intended for external navigation. For this functionality, use the Link component as a wrap to the Pill.

If you are using any CSS from @wpmedia/news-theme-css, you must replace it or copy the CSS into your feature pack custom styles. This includes using the JS utilities.

import { framework, calculateRem } from '@wpmedia/news-theme-css/js/framework';

If you need to migrate over any Sass (functions, utilities, variables):

If you have specific classes you’d want to copy out as pure css:

List of news-theme-css classes

To identify what classes you have in use, refer to the list below (and further down is a helper script to run in your codebase).

news-theme-css class finder script

To help identify where these are used in your codebase, you can try using this helper script which will produce the file news-theme-css-results.json that lists every class used in your feature pack files with it’s line number.

To create and use the helper script, follow these steps:

1. Install glob to help search your repo. You can remove this after.

Terminal window
npm i glob --save-dev

2. Copy the following script into the file class-finder.js inside your feature pack folder.

3. Run the following command:

Terminal window
node class-finder.js

styleProperties

Defining styleProperties in blocks.json and Theme Settings is no longer needed with Arc Themes 2.0. These properties are:

  • primary-font
  • secondary-font
  • primary-color

Users could then import getThemeStyle from 'fusion:themes'; in their feature pack to use the same style properties the Arc Blocks used. Arc Blocks no longer uses these style properties in Themes 2.0 because the Design System is far more robust and enables defining any number of style properties using global tokens and aliases.

Theme Settings no longer displays fields to define these properties, and you can remove them from your blocks.json styleProperties key. If you are importing from getThemeStyle in custom code, these values would no longer be defined, and you must update your custom code.

Change Log Summary

Key Highlights

  • Arc Themes Design System
  • Arc Block Styling
  • Arc Components
  • Resizer v2 support

Breaking Changes

engine-theme-sdk

  • @wpmedia/engine-theme-sdk package has been replaced by @wpmedia/arc-themes-components
  • See deprecated packages

news-theme-css

Arc Blocks do not use news-theme-css, and the Arc Themes Design System is replacing the need for the @wpmedia/news-theme-css dependency. With this release of Themes, there is greater flexibility to define your own global CSS variable tokens and aliases through the Arc Themes Design System, as well as applying targeted block styling to every Arc Block. The dependency is no longer included when deploying with Theme Settings, and it does not need included in your blocks.json when developing locally. The removal of these reduces unnecessary CSS in your bundle.

If you are using any CSS from @wpmedia/news-theme-css, you must replace it.

Deprecated news-theme-css classes in Themes 2.0:

Theme Settings

styleProperties

Defining styleProperties in blocks.json and Theme Settings is no longer needed with Arc Themes 2.0. These properties are:

  • primary-font
  • secondary-font
  • primary-color

Users could then import getThemeStyle from 'fusion:themes'; in their feature pack to use the same style properties the Arc Blocks used. These are no longer used by Arc Blocks in Themes 2.0 as the Design System is far more robust and enables defining any number of style properties using global tokens and aliases.

Theme Settings will no longer display fields to define these properties, and they can be removed from your blocks.json styleProperties key. If you are importing from getThemeStyle in custom code, these values would no longer be defined, you will need to update your custom code

siteProperties

Deprecated site properties include:

  • navColor (Navigation Bar Color Scheme)
  • lightBackgroundLogo (Dark Logo)

The navigation bar properties, including color, may be styled using the new Blocks Styling.

The logo fields have been consolidated, logos may be styled for any background color using Blocks Styling.