Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assigning task object to data #157

Open
tjrosario opened this issue May 27, 2016 · 2 comments
Open

Assigning task object to data #157

tjrosario opened this issue May 27, 2016 · 2 comments

Comments

@tjrosario
Copy link

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
Copy link

wardpeet commented Jul 5, 2016

have you tried looking into what data object contains?

@mbrodala
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants