Closed rhashimoto closed 11 years ago
There is no "seperation". options when defined in the same level as a targetName have a global effect, applying to all targets. You can define options on a per target basis which makes these options only available to that target.
It's up to you how you want to structure it.
Setting namespaces on a targetName doesn't seem to override the value in options with the grunt-closure-tools 0.8.1. If my javascript has goog.provide('foo'), the below code doesn't work because namespaces is required in options:
closureBuilder: {
options: {
closureLibraryPath: '/opt/closure/closure-library',
},
test: {
namespaces: 'foo',
src: ['/opt/closure/closure-library', 'js/'],
dest: './test-compiled.js'
}
And the below code doesn't work, because namespaces in the target doesn't override the value in options:
closureBuilder: {
options: {
closureLibraryPath: '/opt/closure/closure-library',
namespaces: 'bar',
},
test: {
namespaces: 'foo',
src: ['/opt/closure/closure-library', 'js/'],
dest: './test-compiled.js'
}
},
Is there a way to specify multiple targets with different namespaces?
Put the target namespaces
key inside an options
key, like so:
closureBuilder: {
options: {
closureLibraryPath: '/opt/closure/closure-library',
namespaces: 'bar',
},
test: {
options: {
namespaces: 'foo'
},
src: ['/opt/closure/closure-library', 'js/'],
dest: './test-compiled.js'
}
},
The separation of closureBuilder options and targetName hints that the tool may be used for building multiple targets in a single task. If that is intended I don't understand why the required inputs/namespaces configuration is under options. Is it reasonable and possible to have multiple closureBuilder targets each with a distinct namespace? I'm new to grunt so I may just not be understanding how things should work. Thanks!