Within my angularJS application, I have the following line of code:
<span class="build-version">@@appversion</span>
Accompanied by this task in Grunt:
replace: {
dist: {
options: {
patterns: [
{
match: '@@appversion',
replacement: grunt.option('build-version')?grunt.option('build-version'):'#debug'
}
],
usePrefix: false
},
files: [
{expand: true, flatten: true, src: ['<%= yeoman.dist %>/index.html'], dest: '<%= yeoman.dist %>'},
{expand: true, flatten: true, src: ['<%= yeoman.dist %>/scripts/scripts.js'], dest: '<%= yeoman.dist %>/scripts'}
]
}
}
On the production server, files are simply copied from the development server (with different domain names)...
Is there a way to avoid replacing the build version on the production server, perhaps based on the domain name, URL, or other factors?
The only solution I can think of is this snippet of code:
<span class="build-version" ng-hide="location.path().indexOf('prodserv') > -1">@@appversion</span>
Are there more elegant ways to achieve this?