咕噜打开两个不同的文件 [英] grunt-open for two different files

查看:136
本文介绍了咕噜打开两个不同的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

grunt打开两个不同的文件

grunt-open for two different files

我使用 grunt-open 插件,它工作正常。
现在我需要使用不同的任务打开其他文件。
我该怎么做?

I use the grunt-open plugin which works OK. Now I need to open an additional file with a different task. How can I do that?

我试过了:

I have tried:

  open: {
        file: {
            path: appPath + '/coverage/lcov/index.html',
            path2: appPath + '/coverage/lcov-report/index2.html'
        }
    }


 //Here I want to open first line
 grunt.registerTask('openCoverage', ['exec', 'copy', 'mocha_istanbul', 'open:path']);
 //Here I want to map second line
grunt.registerTask('MochaWeb', ['exec', 'copy', 'mochaTest', 'open:path2']);


推荐答案

documentation 显然, path 参数保存了您想要的文件的文件路径打开。您将无法添加路径的后缀版本,如 path2 。相反,您需要为每个希望使用的文件分别使用目标打开。您的配置将如下所示:

From the documentation it is clear that the path parameter holds the filepath of the file you want to open. You won't be able to add suffixed versions of "path", like path2. Instead, you will need to use separate targets for each file you wish to open. Your config would then look like the following:

open: {
    openCoverage: {
        path: appPath + '/coverage/lcov/index.html'
    },
    MochaWeb: {
        path: appPath + '/coverage/lcov-report/index2.html'
    }
}

接下来,您将这些目标添加到您的任务定义中:

Next, you will add these targets to your task definitions:

grunt.registerTask('openCoverage', ['exec', 'copy', 'mocha_istanbul', 'open:openCoverage']);
grunt.registerTask('MochaWeb', ['exec', 'copy', 'mochaTest', 'open:MochaWeb']);

这篇关于咕噜打开两个不同的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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