17

I'm trying to get grunt-contrib-less to compile a less file for me. I have the following gruntfile:

less: {
        files: {
            "httpdocs/static/assets/css/result.css": "httpdocs/static/assets/css/dashboard.less"
        }
    },

The paths are definitely correct, I've triple checked that those files exist, yet, when I run grunt I get the following message:

Running "less:files" (less) task
>> Destination not written because no source files were provided.

What am I missing from my gruntfile to make it properly compile the less file? I'm tearing my hair out because I know it's probably something really simple but I can't figure it out.

Vivian Chen
  • 223
  • 2
  • 6

1 Answers1

22

Your less configuration isn't working because you need to put it into a specific target within less. For example

less: {
   yourTarget : {
        files: {
            "httpdocs/static/assets/css/result.css": "httpdocs/static/assets/css/dashboard.less"
        }
   }
},

and run using

grunt less:yourTarget

You can name the target what ever you want but because less is a multi-task, it needs to have at least one target.

Docs on configuring tasks with targets.

go-oleg
  • 19,272
  • 3
  • 43
  • 44