> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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-to-the-new-cli/migrate-an-app-from-the-legacy-cli/migrate-an-embedded-script-extension.md

## Article Content:

# Migrate an Embedded Script Extension

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/migrate-an-app-to-the-new-cli/migrate-an-app-from-the-legacy-cli/migrate-a-legacy-cli-app-to-the-new-wix-cli.md).

## Folder structure

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

> **Note:** `<name>` is your extension's folder name in the legacy project. The new folder and files use the same name.

## Step 1 | Copy and rename the files

In the new project:

1. Create the folder `src/extensions/site/embedded-scripts/<name>/`.
2. From the legacy project's `src/site/embedded-scripts/<name>/` folder, copy `embedded.html` into the new folder, and rename it to `<name>.html`.
3. Copy any other files the HTML references, such as a script file loaded with a relative `src`, into the new folder.

Don't copy the following legacy files:

- `embedded.json`. You recreate its values in `<name>.extension.ts`.
- `params.dev.json`. Nothing in the new project reads it. If your HTML uses [dynamic parameters](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/supported-extensions/site/embedded-scripts/embedded-script-extension-files-and-code.md#using-dynamic-parameters-in-your-html-code), set their values by passing a `parameters` object to [`embedScript()`](https://dev.wix.com/docs/api-reference/app-management/embedded-scripts/embed-script.md) when you embed the script in a site.

<blockquote class="important">

__Important:__
A site, including your development site, runs the script only after [`embedScript()`](https://dev.wix.com/docs/api-reference/app-management/embedded-scripts/embed-script.md) is called for it. In the legacy project, the development session loaded the script with the values from `params.dev.json`. In the new project, a migrated script shows nothing on a site until you or the site owner call the method. For how to make the call from your app, see [Load the embedded script in your code](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/supported-extensions/site/embedded-scripts/add-an-embedded-script-extension-with-the-wix-cli.md#step-2--load-the-embedded-script-in-your-code).

</blockquote>

## Step 2 | Create the extension file

In the new project:

1. In `src/extensions/site/embedded-scripts/<name>/`, create `<name>.extension.ts`.
2. Add the following code, and set each field to the value the table below specifies:

    ```ts
    import { extensions } from '@wix/custom-extensions';

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

    | Field | Source in legacy project | What to specify |
    |-------|--------------------------|-----------------|
    | `id` | `id` in `embedded.json` | Copy source as is |
    | `name` | `name` in `embedded.json` | Copy source as is |
    | `placement` | `placement` in `embedded.json` | Copy source as is |
    | `scriptType` | `scriptType` in `embedded.json` | Copy source as is |
    | `source` | None | Path to `<name>.html`, relative to `src/` |

<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`:

1. Import the extension:

    ```ts
    import myEmbeddedScript from './extensions/site/embedded-scripts/<name>/<name>.extension';
    ```

2. Add a `.use()` call for it to the `app()` chain, on its own line:

    ```ts
    .use(myEmbeddedScript)
    ```

## Step 4 | Return to the main migration guide

Return to [Install the extension's dependencies](https://dev.wix.com/docs/build-apps/develop-your-app/develop-an-app-with-the-cli/migrate-an-app-to-the-new-cli/migrate-an-app-from-the-legacy-cli/migrate-a-legacy-cli-app-to-the-new-wix-cli.md#install-the-extensions-dependencies) in the main migration guide.