Developing shared code in a workspace
Learn how to develop shared code in a workspace.
If you're not already familiar with shared code and how to create them in the Frosmo Control Panel, see the feature overview and guide.
Creating new shared code in a workspace
To create a piece of share code in a workspace:
-
Click the quick menu button for Shared code, and select Create shared code.
-
Define the shared code settings. For more information about the settings, see Creating and editing shared code.
-
When you're done, click Create.
-
To start executing the shared code on the site, click Activate, and then click Activate to confirm. You can also activate the shared code later by editing the code.
Adding existing shared code to a workspace
When you add an existing piece of shared code from production to a workspace, the Frosmo Control Panel creates a duplicate of the code and places the duplicate in the workspace. In production, the original code remains unaffected. Editing the workspace code does not affect the original production code.
The workspace code inherits the activation status of the original production code. Changing the activation status of one does not affect the activation status of the other.
If the shared code you add to a workspace is bound to a trigger, the trigger is not automatically added to the workspace. To make sure that the code works correctly in the workspace, also add the associated trigger to the workspace.
To access the original production shared code of a piece of workspace shared code, click the quick menu button for the workspace shared code, and select Edit original.
When you publish the workspace, you can choose to either overwrite the production shared code with the workspace version or create a new piece of production shared code from the workspace version.
To add existing pieces of shared code to a workspace:
-
Click the quick menu button for Shared code, and select Add existing shared code.
-
Select the pieces of shared code you want to add to the workspace, and click Add. You can filter the pieces by typing a shared code ID or name in the search field.
-
Optionally, to change the activation status of an added piece of shared code, edit the code.
Editing shared code in a workspace
To edit a piece of share code in a workspace:
-
In the shared code list, click the name of the piece of shared code you want to edit.
-
Edit the shared code settings. For more information about the settings, see Creating and editing shared code.
-
When you're done, click Save.
-
Optionally, activate or deactivate the shared code:
-
If currently active: To stop executing the shared code on the site, click Deactivate, and then click Deactivate to confirm. The piece of shared code is no longer executed on the site (unless a visitor still has the code cached in their browser).
-
If currently inactive: To start executing the shared code on the site, click Activate, and then click Activate to confirm. The piece of shared code is now automatically executed on every page load or when the trigger, if defined, fires.
-
If active, the updated piece of shared code is executed when a visitor next loads a page (unless the visitor still has the old version cached in their browser).
Removing shared code from a workspace
Removing a piece of shared code from a workspace deletes that code. Any edits you've made to the code in the workspace are lost. If the code is based on an existing piece of shared code in production, the original code is not affected in any way.
To remove a piece of shared code from a workspace:
-
In the shared code list, click the quick menu button for the piece of shared code you want to remove, and select Remove.
-
In the confirmation prompt, click Remove.