Closed vargaendre closed 7 years ago
Hi pal, you can do this in the grunt way:
replace: {
dev: {
options: {
patterns: [
{
server_uri: 'localhost'
}
]
},
files: [
{expand: true, flatten: true, src: ['src/**/*.js'], dest: 'build/'}
]
}
dist: {
options: {
patterns: [
{
server_uri: 'prod.domain.com'
}
]
},
files: [
{expand: true, flatten: true, src: ['src/**/*.js'], dest: 'build/'}
]
}
}
Alternatively you could use something like grunt-config in conjunction with grunt-replace:
https://www.npmjs.com/package/grunt-config#environment-variable-in-source-with-grunt-replace-
Thank you for the quick answer! Right now I'm doing it 'the grunt way', but I think it involves a lot of boilerplate. The alternative version looks cool, I check it out. Thanks!
Hi, I'd like to pass in parameters for the replacement. So I'm using this for setting the server's URL in different environments. Would be nice to pass the parameter URL. Is this possible?