我试图根据本文中描述的空白主题更改自定义主题的_theme.xml: http://devdocs.magento.com / guides / v2.0 / frontend-dev-guide / css-topics / css-练习.html

但如果我刷新前端它不会改变。缓存已禁用。

heres我的代码: composer.json

{
"name": "my/blank",
"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.2",
"license": [
    "OSL-3.0",
    "AFL-3.0"
],
"autoload": {
    "files": [
        "registration.php"
    ]
}
.

}

注册.php

\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/my/blank',
__DIR__
.

);

theme.xml

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

有帮助吗?

解决方案

用于自定义主题,请按照以下步骤

创建一个主题目录

为主题创建目录:

  1. 转到/ app / design / frontend。
  2. 创建根据您的供应商名称命名的新目录: / app / design / frontend /.
  3. 在供应商目录下,创建根据的目录 你的主题。 (例如mytheme)

    在主题目录结构中看起来像这个

  4. app/design/frontend/
    ├── <Vendor>/ (my)
    │   │   ├──...<theme>/  (themename)
    │   │   │   ├── ...etc
    │   │   │   ├── ...media
    │   │   │   ├── ...web
    |   |   |   |    ├── ...css
    |   |   |   |    ├── ...images
    |   |   |   |    ├── ...js
    │   │   │   ├── registration.php
    │   │   │   ├── theme.xml
    
    .

    声明您的主题

    从现有的主题向下复制或复制到主题目录

    app/design/frontend/<Vendor>/<theme>
    
    .

    使用以下示例配置:

    <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
         <title>blank</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>
     </theme>
    
    .

    注册您的主题

    在主题目录中添加 注册文件,其中包含以下内容 文件:

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


    您的供应商名称在哪里,是主题代码。

    配置您的主题

    <your Magento install dir>dev\tools\grunt\configs\themes.js
    
        themename: {
            area: 'frontend',
            name: 'my/themename',
            locale: 'en_US',
            files: [
                'css/styles-m',
                'css/styles-l'
            ],
            dsl: 'less'
        },
    
    .

    刷新你的缓存 从管理商店应用主题>配置>设计

其他提示

一旦您创建自定义主题,必须完成两件事

1.清除缓存
2.登录管理员侧,只有它将添加您的自定义主题

许可以下: CC-BY-SA归因
scroll top