5

When we clone new theme from existing parent theme in Magento 2. How we can execute less:newThemName command using grunt CLI ?

As well as how grunt watch will look any changes into newly created theme ?

I have created new theme app\design\frontend\Vendor\luma2

My theme.xml is

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
    <title>Luma 2</title> <!-- your theme's name -->
    <parent>Magento/luma</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
    <media>
        <preview_image>media/preview.png</preview_image> <!-- the path to your theme's preview image -->
    </media>
</theme>
2
  • Have you installed grunt ? Commented Oct 12, 2015 at 13:42
  • Yes, I have installed grunt. As I mentioned Grunt is working fine. Issue is mentioned in question. Commented Oct 13, 2015 at 5:31

1 Answer 1

5

Goto \dev\tools\grunt\configs, Open themes.js and add the part as shown in the image.

enter image description here

Now Open less.js and add the part shown in the image enter image description here

Now you can run grunt less:luma2 task, and it will generate the pub static files for the theme

4
  • Hi Taral, Should we need to add it manually every time for new theme creation of Magento 2? Commented Oct 13, 2015 at 9:28
  • Yes, when ever you add new theme, you will need to add its details to the to files mentioned above. Commented Oct 14, 2015 at 5:22
  • Is there another option to add it to grunt? (include .js files via XML config?) i see that whole grunt folder by default is in .gitignore
    – Bogdan Le
    Commented Jul 11, 2016 at 11:30
  • how can do these things with clis instead of edit less.js and thems.js
    – ali gh
    Commented Apr 15, 2017 at 13:22

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.