I'm running Magento 2.1.7 CE and I need to move the
navigation.sections block inside of the
header-wrapper. I found the reference to
vendor/magento/module-theme/view/frontend/layout/default.xml so I created a theme and I'm trying to modify the layout to just move that one block.
Here's the XML I setup to move
navigation.sections inside of
header-wrapper (saved under
<?xml version="1.0"?> <page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <move element="navigation.sections" destination="header-wrapper" before="logo" /> </body> </page>
This technically works and when I apply this theme the
navigation.sections block is moved to that container, but only in developer mode. If I change to production mode with this theme enabled, I run into these issues:
magento setup:static-content:deployfails (I need to clear a lot of directories under
var/to get it to work)
- Cannot minify or bundle JS or CSS, it just fails
- Layout on the front page is completely wrecked
require.jsthat are included in the original
layout.xmlthat I'm trying to extend
I tried copying the original
layout.xml and just adding the
move tag but no luck. The only way I can get it to work without Magento having a meltdown is by adding the
move tag to the original file, but that's not what I want.
What am I doing wrong?
Here is my
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::THEME, 'frontend/ThemeName/default', __DIR__ );
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <!-- Theme's name --> <title>Theme Name</title> <!-- Parent theme --> <parent>Magento/luma</parent> <media> <!-- Theme's preview image --> <preview_image>media/preview.jpg</preview_image> </media> </theme>
I found this in
"/path/to/magento/pub/static/frontend/ThemeName/default/en_US/mage/requirejs/mixins.js" Warning!file_get_contents(/path/to/magento/pub/static/frontend/ThemeName/default/en_US/mage/requirejs/mixins.js): failed to open stream: No such file or directory in /path/to/magento/vendor/magento/framework/Filesystem/Driver/File.php:149
So the compilation step is looking for
requirejs/mixins.js which is NOT in my theme, I just want those pulled from the Luma theme. Again, what's an actual fix for this?
This is how I have been clearing cache so far:
rm -rf var/cache/* var/generation/* var/view_preprocessed/* var/page_cache/* pub/static/* var/di/* \ && php bin/magento cache:flush