2

I've created my own custom theme and uploaded it to my private package repository. This works fine and downloads my folder into vendor/<vendor>/theme-my-theme I run:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

My theme doesn't list itself in setup:static-content:deploy or in the admin panel. I then install snowdog/theme-blank-sass and this shows up fine.

Any ideas as to how to get Magento to register my theme? Please note that this theme was developed in app/design/frontend and worked fine.

composer.json:

{
    "name": "vendor/theme-my-theme",
    "description": "My Base Theme",
    "type": "magento2-theme",
    "version": "1.0.0",
    "require": {
        "magento/theme-frontend-luma": "100.1.*",
        "magento/framework": "100.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/Vendor/my-theme',
    __DIR__
);

theme.xml:

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
 <title>My Base Theme</title>
 <parent>Magento/luma</parent>
 <media>
     <preview_image>web/images/my-logo.png</preview_image>
 </media>

UPDATE:

I've found the cause of the problem. In Composer's installed.json file my theme declaration is missing the autoload section (as well as description). This means that Composers autoload_files.php isn't getting updated with my autload file registration.php. Anyone know more about this or how to fix it?

  • First of all, Welcome to Magento Stack. Did set your theme in Magento2 Admin ? – Abhishek Panchal Aug 18 '17 at 14:41
  • Thanks for the welcome. :) It doesn't show up in magento 2 admin but the snowdog/theme-blank-sass does. I can't see any differences (aside from my necessary configs) in the important files between the theme on packgist vs my custom theme from private repo – Max Atkins Aug 18 '17 at 14:44
  • Can you please update your Question with your code. How you created your custom theme? – Abhishek Panchal Aug 18 '17 at 14:46
  • @AbhishekPanchal done now – Max Atkins Aug 18 '17 at 14:52
  • Please make sure all file name should be in small letters. Also version shouldn't be ''dev-master'. Please check below link to create custom theme. devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/… – Abhishek Panchal Aug 18 '17 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.