I have a service where I manage my requests to a webservice and actually I have defined the webservice url on this service:
(function ()
{
angular.module("MyProject")
.factory("Webservice", ["$http", function ($http)
{
var URLbase = function ()
{
//return "http://myproject.link.pt/Service/Service.svc/";
return "http://localhost/MyProject/Service.svc/";
}
var login = function (param) {
var serviceURL = URLbase() + "ValidateLogin";
return $http.post(serviceURL, JSON.stringify({ username: param.Username, password: param.Password }));
}
var loginResult = function (response) {
return exists(response) && exists(response.data) && exists(response.data.ValidateLoginResult)
? response.data.ValidateLoginResult
: null;
}
return {
Login: login,
LoginResult: loginResult
}
}])
})();
But when I need to publish my project I frequently forget to comment and uncomment the paths on the URLbase().
There is any way to do this on the gulpfile.js?
On my gulpfile.js I have two different tasks to build for development or for production and I thought that was nice if I could done that management there:
gulp.task('build-development', function (done)
{
config.minify = false;
var tasks = ['html', 'resources', 'assets', 'sass', 'js', 'vendors'];
seq('clean', tasks, done);
});
gulp.task('build-production', function (done)
{
config.minify = true;
var tasks = ['html', 'resources', 'assets', 'sass', 'js', 'vendors'];
seq('clean', tasks, function() {
notifier.notify({ title: 'Project publishment', message: 'Done' });
});
});
I already tried to create a variable on my gulpfile.js an access it on a AngularJS file but I got an error saying that variable isn't defined.