Skip to content

Commit

Permalink
add another section for preview image
Browse files Browse the repository at this point in the history
  • Loading branch information
bka committed Sep 29, 2023
1 parent 789b943 commit b493c35
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion theme-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,31 @@ ComponentRegistrar::register(
);
```

4. To load the new theme, run the command `php bin/magento setup:upgrade`.
4. To load the new theme, run the command `bin/magento setup:upgrade`.

Your custom theme is now ready to be customized and extended as per your requirements.

## Define a Preview Image (Optional)

You can specify a preview image for your theme using the following XML configuration in your `theme.xml`:

```xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>MyTheme</title>
<parent>Magento/blank</parent>
<media>
<preview_image>media/preview.jpg</preview_image>
</media>
</theme>
```

Ensure that the specified image file exists in your theme directory. If it doesn't, running `bin/magento setup:upgrade` will produce an error:

```
File "app/design/frontend/Acme/MyTheme/media/preview.jpg" does not exist.
```

## Theme Inheritance

Magento 2 supports theme inheritance, allowing you to extend and customize existing themes. This reduces duplication and
Expand Down

0 comments on commit b493c35

Please sign in to comment.