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 -->
        <preview_image>media/preview.png</preview_image> <!-- the path to your theme's preview image -->
  • Have you installed grunt ? – Suresh Chikani Oct 12 '15 at 13:42
  • Yes, I have installed grunt. As I mentioned Grunt is working fine. Issue is mentioned in question. – Praful Rajput Oct 13 '15 at 5:31

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

| improve this answer | |
  • Hi Taral, Should we need to add it manually every time for new theme creation of Magento 2? – Praful Rajput Oct 13 '15 at 9:28
  • Yes, when ever you add new theme, you will need to add its details to the to files mentioned above. – Taral Patoliya Oct 14 '15 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 Lewis Jul 11 '16 at 11:30
  • how can do these things with clis instead of edit less.js and thems.js – ali gh Apr 15 '17 at 13:22

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.