Abbas
Abbas

Reputation: 97

multiple Gruntfilejs files

I'm new to bower and grunt and I just started my first project with the below bower dependancies:

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"
            }
        }
    }

Gruntfile.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']);


};

I noticed that bower_components/bootstrap-rtl/ contains another Gruntfile.js.

Is there away to call bower_components/bootstrap-rtl/Gruntfile.js from my Gruntfile.js before the bower:install?

Upvotes: 0

Views: 176

Answers (1)

bevacqua
bevacqua

Reputation: 48476

You can use --gruntfile to determine the location of the Gruntfile.

Check out the CLI source code for more info.

Example use:

grunt jshint --gruntfile bower_components/bootstrap-rtl/Gruntfile.js

You could also use grunt-grunt, which I just wrote for this kind of scenario.

You configure it like this:

grunt.initConfig({
    grunt: {
        boots: {
            gruntfile: 'bower_components/bootstrap-rtl/Gruntfile.js',
            tasks: ['some', 'tasks']
        }
    }
});

Then you could just set up an alias, such as below:

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

Hope it works for you.

Upvotes: 1

Related Questions