firstandthird / load-grunt-config

Grunt plugin that lets you break up your Gruntfile config by task
firstandthird.github.io/load-grunt-config/
MIT License
374 stars 64 forks source link

Assigning task object to data #157

Open tjrosario opened 8 years ago

tjrosario commented 8 years ago

I'm trying to pull in svn info (using this package https://github.com/kevinkao/grunt-svn-info), and wanted to know how to pass the svn_info object to other tasks. I tried doing something below, but no luck. Could you shed some light on what I am doing wrong?

module.exports = function(grunt) {
    var configs, options;

    // load tasks from 'grunt_tasks/'
    grunt.loadTasks("grunt_tasks");

    options = {
        configPath: require("path").join(process.cwd(), "grunt_tasks"),
        init: true,
        pkg: grunt.file.readJSON("package.json"),
        data: {
            svn_info: '<%= svn_info %>'
        }
    };

    configs = require("load-grunt-config")(grunt, options);
};

/ * some task */
module.exports = function(grunt, data) {
  console.log(data.svn_info);
};
wardpeet commented 8 years ago

have you tried looking into what data object contains?

mbrodala commented 8 years ago

@tjrosario Maybe I'm missing something but AFAIS you could simply use <%= svn_info.* %> in your external task configurations without doing anything.