grunt-contrib-less找不到源文件,即使路径正确 [英] grunt-contrib-less cannot find source files even though path is correct

查看:242
本文介绍了grunt-contrib-less找不到源文件,即使路径正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让grunt-contrib-less为我编译一个较少的文件。我有以下gruntfile:

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"
        }
    },

路径肯定是正确的,我三次检查这些文件存在,但是,当我运行grunt我得到以下消息:

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.

我从gruntfile丢失了什么,以使其正确编译less文件?我在撕毁我的头发,因为我知道这可能是非常简单,但我不能想出来。

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.

推荐答案

less 配置不工作,因为您需要将它放入中的特定目标 。例如

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"
        }
   }
},

并使用

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.

使用目标配置任务的文档

这篇关于grunt-contrib-less找不到源文件,即使路径正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆