Magento – Grunt theme source files missing when running Grunt exec

gruntmagento-2.1magento-2.1.4

I have a theme that extends the Luma theme. I am trying to get Grunt working to do preprocessing. So far, I don't have any changes/additions in my theme at all. I setup my themes.js as follows:

module.exports = {
   ...
    training_test: {
        area: 'frontend',
        name: 'Training/test',
        locale: 'en_US',
        files: [
            'css/styles-m',
            'css/styles-l'
        ],
        dsl: 'less'
    }
};

I do not have any root source files, but the documentation states that if you do not have any, use those from the parent theme.

When I run grunt exec:training_test I get the following error message:

Processed Area: frontend, Locale: en_US, Theme: Training/test, File type: less.
>> [InvalidArgumentException]
>>   Verify entered values of the argument and options. Unable to resolve the source file for 'frontend/Training/test/en_US/css/styles-m.less'
>>

I setup Grunt using a build script (on Ubuntu, hence the symlink):

sudo apt-get -y install nodejs
sudo apt-get -y install npm
sudo npm install -g grunt-cli
sudo ln -s /usr/bin/nodejs /usr/bin/node
cd /var/www/html/public; npm install

I then ran the magento deploy task (not sure if this is required or not):

bin/magento dev:source-theme:deploy

I noticed that the Luma theme also does not extend the source files in question (css/styles-m, css/styles-l):

luma: {
    area: 'frontend',
    name: 'Magento/luma',
    locale: 'en_US',
    files: [
        'css/styles-m',
        'css/styles-l'
    ],
    dsl: 'less'
},

Could it be an issue of multiple theme inheritance?

Best Answer

I don't know if it's the case, but try to setup your theme settings with real file names on themes.js. For example, if you set "css/styles-m" and "css/styles-l", create less files in your theme.

While your theme has <parent>Magento/luma</parent> in theme.xml, it has inherited all styles.

Related Topic