在另一个Gruntfile上运行一个grunt任务 [英] Running a grunt task on one Gruntfile from another

查看:133
本文介绍了在另一个Gruntfile上运行一个grunt任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目根目录中有一个Gruntfile。我还通过Bower在app / components / jquery目录中安装了jQuery。

I have a Gruntfile in the root of my project. I also have jQuery installed via Bower in an app/components/jquery directory.

作为我的Gruntfile的一部分,我想在jQuery Gruntfile上运行一些命令来构建一个自定义版本的库。

As part of my Gruntfile I'd like to run some commands on the jQuery Gruntfile to build a custom version of the library.

如何从我的Gruntfile获取?

How can I get at their Gruntfile from mine?

推荐答案

您可以创建一个简单的任务,使产生咕噜声在您的文件夹中想要:

You can create a simple task that spawns grunt in the folder you want:

grunt.registerTask('run-grunt', function () {
    var done = this.async();
    grunt.util.spawn({
        grunt: true,
        args: [''],
        opts: {
            cwd: 'app/components/jquery'
        }
    }, function (err, result, code) {
        done();
    });
});

这篇关于在另一个Gruntfile上运行一个grunt任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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