【问题标题】:Magento 2 custom theme is not deployedMagento 2 自定义主题未部署
【发布时间】:2016-05-31 19:44:28
【问题描述】:

我为 Magento 2 生产版创建了一个自定义主题。我从后端选择了我的主题。但它只呈现 HTML。我部署了静态内容,但我的主题不在

pub\static\frontend\Magento

目录,所以我得到 404 .css.js 文件。我试过设置文件权限,但没有运气。在部署 luma 主题后的命令行窗口中,它会继续部署 admin。任何帮助表示赞赏。

文件结构:

app/design/frontend/Muaw/mytheme:

|-etc
|   |-view.xml
|-media
|   |-preview.png
|-registration.php
|-theme.xml
|-composer.json
|-web
|   |-css
|   |-js
|   |-fonts
|   |-images
|-Magento_Theme
|   |-layout
|   |   |-default.xml

文件:

主题.xml:

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>My Theme</title> <!-- your theme's name -->
<parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
<media>
    <preview_image>media/preview.jpg</preview_image> <!-- the path to your theme's preview image -->
</media>

composer.json:

{
"name": "magento/theme-frontend-luma",
"description": "N/A",
"require": {
    "php": "~5.5.0|~5.6.0|~7.0.0",
    "magento/theme-frontend-blank": "100.0.*",
    "magento/framework": "100.0.*"
},
"type": "magento2-theme",
"version": "100.0.1",
"license": [
    "OSL-3.0",
    "AFL-3.0"
],
"autoload": {
    "files": [
        "registration.php"
    ]
}
}

registration.php:

<?php
    /**
     * Copyright © 2015 Magento. All rights reserved.
     * See COPYING.txt for license details.
    */
    \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::THEME,
        'frontend/Muaw/mytheme',
        __DIR__
    );

提前致谢。 :)

【问题讨论】:

    标签: deployment command-line themes file-permissions magento2


    【解决方案1】:

    创建您的 media/preview.jpg 并将您的 composer.json 文件中的 name 更改为 Muaw/mytheme

    【讨论】:

      猜你喜欢
      • 2017-02-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-11
      • 2016-10-09
      • 1970-01-01
      • 1970-01-01
      • 2019-01-01
      • 1970-01-01
      相关资源
      最近更新 更多