Francisc
Francisc

Reputation: 80495

Change vars in JS file with grunt task

Let's say you have a file that contains these 2 vars, but also other content

//Other code above
var endpoint='...';
var redirectUrl='...';
//Other code below

Now, is there a way for Grunt to change the value of those vars depending on build params?

Thanks.

Upvotes: 0

Views: 26

Answers (1)

Lajos Veres
Lajos Veres

Reputation: 13725

If you enclose your line with something easily matchable. (Or if the original values are unique enough, it can be fine as well.)

You can use this plugin:

https://github.com/outaTiME/grunt-replace

To replace it with something else.

Upvotes: 1

Related Questions