1

Currently working with a Magento 2.2.0 theme I made from scratch and I am using Grunt task runner to compile the LESS files to css.

Theme structure in app/design/frontend/<vendor>/<theme_name> is as follows: theme structure

<theme alias>: {
    area: 'frontend',
    name: '<vendor>/<theme>',
    locale: 'en_US',
    files: [
        'css/styles'
    ],
    dsl: 'less'
}

As I try to run grunt exec:<theme alias>, I always get the following error:

jit-grunt: Plugin for the "&&" task not found. If you have installed the plugin already, please setting the static mapping. See https://github.com/shootaroo/jit-grunt#static-mappings

and this is for every part of the code that runs in the background for the specific task. Happens even with sudo. And yeah, I did clean assets beforehand + cache is disabled at all times.

Further on, running grunt less:<theme alias> gets me:

>> Destination pub/static/frontend/<vendor>/<theme_name>/en_US/css/styles.css not written because no source files were found.

Running same command with -v (verbose) flag:

Loading "grunt-contrib-less" plugin

Registering "/var/www/html/mage/node_modules/grunt-contrib-less/tasks" tasks.
Loading "less.js" tasks...OK
+ less

Running "less:<theme alias>" (less) task
Verifying property less.<theme alias> exists in config...OK
Files: [no src] -> pub/static/frontend/<vendor>/<theme_name>/en_US/css/styles.css
Options: banner="", sourceMap, strictImports=false, sourceMapRootpath="/", dumpLineNumbers=false, ieCompat=false
>> Destination pub/static/frontend/<vendor>/<theme_name>/en_US/css/styles.css not written because no source files were found.

Done.

Grunt versions: grunt-cli v1.2.0 grunt v1.0.1

Had an idea that it could have something to do with permissions at some point when these tasks run, although tried running every command with sudo and fixing permissions to 777, but it's the same error (Destination not written...) for every theme assets there.

While trying to do same in Magento 2.1, there are no errors.

Goal here is to run grunt watch, but the only way I can somehow style the theme is to delete pub/static after every change in LESS, let the Magento do its asset compiling and refresh the browser although I want back the workflow with grunt watch.

How do I fix this? Thanks in advance, hope this is verbose enough.

1

The problem is your node version needs updated. This is why you are getting the error jit-grunt: Plugin for the "&&" task not found. A newer language construct is being used by grunt which is not supported by your version of node. I'm not sure what the minimum required version is but I can confirm it works with v8.11.1.

grunt less will not work until grunt exec runs.

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.