> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Migrate an Embedded Script Extension

## Article: Migrate an Embedded Script Extension

## Article Link: https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/migrate-an-app-from-legacy-cli/migrate-an-embedded-script-extension.md

## Article Content:

# Migrate an Embedded Script Extension

This guide explains how to add an embedded script extension to your new Wix CLI project as part of [migrating an app from the legacy Wix CLI](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/about-the-wix-cli.md).

## Folder structure

| Legacy | New |
|--------|-----|
| `src/site/plugins/<name>/embedded.json` | `src/extensions/site/plugins/embedded-script/<name>/<name>.extension.ts` |
| `src/site/plugins/<name>/embedded.html` | `src/extensions/site/plugins/embedded-script/<name>/<name>.html` |

## Step 1 | Move and rename files

To move existing files into the new project:

1. In the new project, create the folder `src/extensions/site/plugins/embedded-script/<name>/`.
2. Copy `embedded.html` from the legacy project's `src/site/plugins/<name>/` folder into the new project's `src/extensions/site/plugins/embedded-script/<name>/` folder, and rename it to `<name>.html`.

Don't copy the old `embedded.json` file. It is replaced by a new `.extension.ts` file.

## Step 2 | Create the extension file

In `src/extensions/site/plugins/embedded-script/<name>/`, create `<name>.extension.ts`:

```ts
import { extensions } from '@wix/astro/builders';

export default extensions.embeddedScript({
  id: '<id-from-embedded.json>',
  name: '<name-from-embedded.json>',
  placement: '<placement-from-embedded.json>',
  scriptType: '<scriptType-from-embedded.json>',
  source: './extensions/site/plugins/embedded-script/<name>/<name>.html',
});
```

| Field | Source | Required |
|-------|--------|----------|
| `id` | `id` from `embedded.json` | Yes. Must match legacy value to preserve the extension. |
| `name` | `name` from `embedded.json` | Yes |
| `placement` | `placement` from `embedded.json` | Yes |
| `scriptType` | `scriptType` from `embedded.json` | Yes |
| `source` | Path to `<name>.html`, relative to `src/` | Yes |

<blockquote class="important">

__Important:__
The `id` must match the value from the legacy `embedded.json`. Otherwise, the new entry is treated as a separate extension instead of a continuation of the legacy one.

</blockquote>

## Step 3 | Register the extension

In the new project, in `src/extensions.ts`, import the extension and add it with `.use()`:

```ts
import { app } from '@wix/astro/builders';
import myEmbeddedScript from './extensions/site/plugins/embedded-script/<name>/<name>.extension';

export default app().use(myEmbeddedScript);
```

## Step 4 | Return to the main migration guide

Return to the [Test, build, and release](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/about-the-wix-cli.md#test-build-and-release) step in the main migration guide.