Gruntjs 多个GrunFileJS文件

Gruntjs 多个GrunFileJS文件,gruntjs,bower,Gruntjs,Bower,我是新来的bower和grunt,我刚开始我的第一个项目,有以下bower依赖性: bower.json { "name": "test", "version": "0.0.0", "authors": [ "" ], "license": "MIT", "ignore": [ "**/.*", "node_modules", "bower_comp

我是新来的
bower
grunt
,我刚开始我的第一个项目,有以下bower依赖性:

bower.json

    {
       "name": "test",
       "version": "0.0.0",
       "authors": [
       ""
       ],
       "license": "MIT",
       "ignore": [
       "**/.*",
       "node_modules",
       "bower_components",
       "test",
       "tests"
       ],
       "dependencies": {
        "bootstrap-rtl": "~0.9.1",
        "jquery-ui-bootstrap": "~0.2.5",
        "jquery-ui": "~1.10.3",
        "jquery": "~2.0.3"
        },
        "exportsOverride": {
            "*": {
                "js": "**/*.js",
                "css": "**/*.css"
            }
        }
    }
Grunfile.js

module.exports = function(grunt) {

    // Configuration goes here
    grunt.initConfig({
        bower: {
            install: {
                options: {
                    targetDir: './lib',
                    layout: 'byType',
                    install: true,
                    verbose: false,
                    cleanTargetDir: false,
                    cleanBowerDir: false,
                    bowerOptions: {}
                }
            }
        }
        //--end
    });
    // Load plugins here
    grunt.loadNpmTasks('grunt-bower-task');



    // Define your tasks here
    grunt.registerTask('default', ['bower']);


};
我注意到
bower\u components/bootstrap rtl/
包含另一个
grunfile.js

bower:install
之前,是否可以从my
Gruntfile.js
调用
bower\u组件/bootstrap rtl/Gruntfile.js

您可以使用
--Gruntfile
来确定Gruntfile的位置

有关更多信息,请查看

示例用法:

grunt jshint --gruntfile bower_components/bootstrap-rtl/Gruntfile.js
你也可以使用,我刚刚为这种场景写的

您可以这样配置它:

grunt.initConfig({
    grunt: {
        boots: {
            gruntfile: 'bower_components/bootstrap-rtl/Gruntfile.js',
            tasks: ['some', 'tasks']
        }
    }
});
然后,您可以设置一个别名,如下所示:

grunt.registerTask('build', ['grunt:boots', 'compile']);

希望它对您有用。

为什么要调用他们的
GrunFile
?我想在构建项目的同时构建引导rtl。我想通过一次对gruntjs文件的调用来构建两个项目。与Ant编译依赖java项目的方法相同。编写了一个grunt插件,可以为您做到这一点:),请参阅更新的答案