3

I'm beginning with Magento and it's incredible that create a theme is so complicated...

I've understand that to add my css to the head I need to override a layout. So I override default_head_blocks.xml with this content :

<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>    
        <!-- Add your own CSS files -->
        <css src="css/styles.css" />
    </head>
</page>

But this not works. Also after : - ./bin/magento setup:upgrade - ./bin/magento cache:flush && ./bin/magento cache:clean

Structure of my theme : structure

2
  • The theme directory name should be lowercase - vehicules. I'm not sure if this is required or just a convention but try changing that. Commented Dec 27, 2016 at 23:59
  • I changed the theme directory name, remove the old and flush and it appears in admin > content > design > theme. But when in my css i try to style a template from a custom module it doesn't works...
    – Kpone
    Commented Dec 28, 2016 at 9:21

2 Answers 2

1

I found the solution to activate the theme :

I managed to change the theme if you change the setting as single shop.

Store > Configuration > General > General > Single-Store Mode > YES

content > Configuration > Edit Default theme > Smartwave Porto

0

You can add a "_extend.less" file to –

/app/design/frontend/Test/Vehicules/Magento_Theme/web/css/source

  • Make sure the files name is exactly written as seen above. You can use this file as a standard CSS file but with additional LESS functionality. Naming your files is very important if you work with parent/child themes.
  • Clean cache
  • Read more: How do you override LESS in a custom theme?
3
  • And all less files will be loaded ? And then when I change something in the Less file I just need to clean caches ? because from now I was using gulp to compile less filles in put in the source folder to made compressed versions in css folder :)
    – Kpone
    Commented Dec 28, 2016 at 8:58
  • But why his solution about the css not works ?
    – Kpone
    Commented Dec 28, 2016 at 9:11
  • All I do after doing changes in the LESS file is: php_cli bin/magento setup:upgrade and reload the page. I'm not an expert but I guess there is also an easier way to do it.
    – eskaliert
    Commented Dec 28, 2016 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.