Closed szimek closed 11 years ago
Where does yeomanConfig come from? If it's a global variable, it should work.
Right... the simplest solutions are the best :) It's currently defined like this:
module.exports = function (grunt) {
var yeomanConfig = {
app: 'app'
};
grunt.initConfig({
yeoman: yeomanConfig,
...
};
}
but I can make that a global variable, especially that there won't be grunt.initConifig
anymore.
Is there a way to run specific config before others are executed? The yeoman
option inside grunt.initConfig
is later used in many tasks like:
watch: {
coffee: {
files: ['<%= yeoman.app %>/scripts/**/*.coffee'],
tasks: ['coffee:dist']
}
}
If it's possible, maybe I could just define yeoman
option and instead of using global yeomanConfig
variable, create a local one if needed:
module.exports = function (grunt) {
var yeoman = grunt.option('yeoman');
return { /* ... */ };
};
If I understand it correctly, you could do something like:
module.exports = function(grunt) {
var yeomanConfig = {
app: 'app'
};
require('load-grunt-config')(grunt, {
config: { //additional config vars
yeoman: yeomanConfig
}
});
};
and then you'll have access to yeoman in your tasks
watch.yaml (or .js or .coffee)
coffee:
files: '<%= yeoman.app %>/scripts/**/*.coffee'
tasks: 'coffee'
Thanks!
I've got the following configuration:
It looks like the following syntax is supported:
and
modRewrite
andlrSnippet
variables are local to this config, so it's not a problem, butyeomanConfig
is shared with other tasks as well. Is there any way to pass it there?