3

I have a custom theme Mycompany/mytheme including <Magento>/<blank> as parent.

The locale is set to de_DE.

When I execute php bin/magento setup:static-content:deploy de_DE everything works fine, my custom-m.less and custom-l.less get compiled into custom-m.css and custom-l.css and I also get the Magento/blank theme files and viewing the magento website with chrome also loads these files.

custom-m.less and custom-l.less are exact copies from the blank themes styles-m and styles-l less files


The Problem:

Using grunt exec:mytheme and grunt less:mytheme kinda behaves strange. I still load the Magento/blank styles-l.css but everything else gets loaded via their own less component files (e.g. _extend.less or _module.less) enter image description here


Here is my grunt config file:

magento-root/dev/tools/grunt/configs/themes.js

module.exports = {

    -----------------------------
    ... blank and luma stuff here
    -----------------------------

    mytheme: {
        area: 'frontend',
        name: 'Mycompany/mytheme',
        locale: 'de_DE',
        files: [
            'css/styles-m',
            'css/styles-l',
            'css/email',
            'css/email-inline',
            'css/custom-m',
            'css/custom-l'
        ],
        dsl: 'less'
    },

    --------------------------
    ... backend stuff here ...
    --------------------------

};

'css/styles-m', 'css/styles-l', 'css/email', 'css/email-inline' are not inside my mytheme, but as magento devdocs says should anyways be included because of the parent theme inheriting. I also tried to not include these files inside the config file = Same result

BTW: grunt commands throw no errors, seems to work fine, in var/view_preprocessed I see my custom files inside the Mycompany/mytheme folders, same as pub/static/frontend....

I deleted the cache after each new try

Server-side compilation enabled

developer mode enabled


Question: Can someone help me with this? Can someone explain whats wrong?

And what is the expected workflow? Magento Documentation is a bit unclear about that

  1. php bin/magento setup:static-content:deploy -> grunt watch ?
  2. php bin/magento setup:static-content:deploy -> grunt exec:mytheme -> grunt watch ?
  3. grunt exec:mytheme -> grunt watch ?

Should I use the magento php compiler at all? Because I don't want to, way too slow

  • There is two types of compilation in magento, you can compile via grunt or server side compilation. Which type are you used for it ? – Suresh Chikani Oct 13 '16 at 17:42
  • as I described, using server-side compilation using php bin/magento setup:static-content deploy works fine. When I use grunt I get this strange behavior, as described above – juhanix Oct 14 '16 at 7:15
0

You need use Grunt for display source code inspecting in firebug and you have explain how it works.
Magento 2 - How to configure Grunt in PhpStorm

Your Answer

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

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