扩展不适用于动态选择的grunt-contrib-less任务

 IvyShao520 发布于 2023-02-10 13:12

我一直在玩Grunt,其中一个我想用它来编译我的LESS文件,但由于某种原因扩展:true(我从底部向上评论了所有内容,它在评论后停止抛出错误在less中:mini任务导致此错误:警告:对象true没有方法'indexOf'使用--force继续.有谁知道为什么会这样?我可以在grunt-contrib-copy中动态构建文件对象没问题,并且需要展开才能使其他选项工作.

less: { // Set up to detect files dynamically versus statically

  mini: {
    options: {
      cleancss: true, // minify
        report: 'min' // minification results
    },
    files: {
      expand: true, // set to true to enable options following options:
        cwd: "dev/less/", // all sources relative to this path
        src: "*.less", // source folder patterns to match, relative to cwd
        dest: "dev/css/", // destination folder path prefix
        ext: ".css", // replace any existing extension with this value in dest folder
        flatten: true  // flatten folder structure to single level
    }
  }
}

谢谢

1 个回答
  • files旨在用作数组或src-dest映射.Grunt将less.mini.filessrc-dest映射中的上述属性解释.请参阅:http://gruntjs.com/configuring-tasks#files-object-format

    files如果您不使用该格式,则无需嵌套属性.将您的配置修改为:

    less: { // Set up to detect files dynamically versus statically
      mini: {
        options: {
          cleancss: true, // minify
            report: 'min' // minification results
        },
        expand: true, // set to true to enable options following options:
        cwd: "dev/less/", // all sources relative to this path
        src: "*.less", // source folder patterns to match, relative to cwd
        dest: "dev/css/", // destination folder path prefix
        ext: ".css", // replace any existing extension with this value in dest folder
        flatten: true  // flatten folder structure to single level
      }
    }
    

    2023-02-10 13:14 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有