Template variables within option files
Closed this issue · 2 comments
drasco commented
I have a "template variable" I want to define within my karma.js option file, instead of specifying it in gruntfile.js (using the "data" parameter).
Is this possible?
(Sorry, I tried google.)
Cheers
module.exports = {
'variables': {
'jsFilesForTesting': [
'bower_components/jquery/dist/jquery.js',
...
'test/**/*Spec.js'
]
},
'development': {
'configFile': 'karma.conf.js',
'options': {
'files': [
'<%= variables.jsFilesForTesting %>',
'source/**/*.js'
],
}
},
'dist': {
'options': {
'configFile': 'karma.conf.js',
'files': [
'<%= variables.jsFilesForTesting %>',
'dist/<%= package.namelower %>-<%= package.version %>.js'
],
}
},
'minified': {
'options': {
'configFile': 'karma.conf.js',
'files': [
'<%= variables.jsFilesForTesting %>',
'dist/<%= package.namelower %>-<%= package.version %>.min.js'
],
}
}
};
SolomoN-ua commented
Hi @drasco, I don't think that extending config object is possible. But you can always use any config field from any task configuration, like: <%= test.dist.options.configFile %>
or <%= test.variables.jsFilesForTesting %>
(where test
is example of your file name)
P.S.: But be careful small mistake with this feature can cause problems which will be hard to find and/or debug.
drasco commented
Thanks. I settled on putting the variables in the master gruntfile :)