Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grunt-contrib-less cannot find source files even though path is correct

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.

like image 834
Vivian Chen Avatar asked Jul 17 '13 23:07

Vivian Chen


1 Answers

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.

like image 125
go-oleg Avatar answered Oct 17 '22 17:10

go-oleg