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

How does one share values between tasks? #146

Closed deiga closed 8 years ago

deiga commented 8 years ago

I have a destination path for all my builds and I want it to come from a variable. How can I create a variable that all my tasks see?

SolomoN-ua commented 8 years ago

Hi, you can define it in data: {} property

require('load-grunt-config')(grunt, {
    //...
    data: {
        someVar: 42,
        otherVar: {
            foo: 'some/path'
        }
    }
    //...
});

and then use it in any config string like '<%= someVar %>' and '<%= otherVar.foo %>', also the same way you can access to any other config properties (for example '<%= copy.app.dest %>')

deiga commented 8 years ago

Thank you! Maybe add this to the readme? :)

SolomoN-ua commented 8 years ago

it is in readme, in some way :) but maybe I will try to improve it...

SolomoN-ua commented 8 years ago

@deiga let me know if you will have other issues. Have a nice day!