Grunt观看两个单独的LESS文件并输出到两个单独的CSS文件中

时间:2014-08-13 16:34:04

标签: css gruntjs less grunt-contrib-watch

我正在使用LESS作为我的主应用程序,还需要一个不属于主应用程序的单独CSS文件。我正在尝试为现有的grunt监视任务添加新的源和目标

less: {
    development: {
        options: {

            paths: ["path/to/less", "// path/to/2nd.less??"],
            yuicompress: true
        },
        files: {
            "path/to/build.css": ["path/to/less"]
        },
        //other src destination here?
        files: {
           "path/to/2nd.css": ["path/to/2nd.less"]
          }
        }
    }
},
watch: {
    files: ["path/to/less", "path/to/2nd.less"],
    tasks: ["less"]
}

1 个答案:

答案 0 :(得分:0)

感谢@jgillich指点我的文档。解决方案:

less: {
    development: {
        options: {
        paths: ["path/to/less"],
        yuicompress: true
    },
    files: {
        "path/to/build.css": ["path/to/less"]
    },
  }
},
    2nd: {
options: {
 // same as above but with new paths
    }
  }
},
watch: {
    files: ["path/to/less", "path/to/2nd.less"],
    tasks: ["less"]
}