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

﹥>﹥吖頭↗ 提交于 2019-12-23 06:54:19

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/17712214/grunt-contrib-less-cannot-find-source-files-even-though-path-is-correct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!