Created
June 6, 2018 08:55
-
-
Save mrhieu/a7ba21deae4c5183e5f6b41b0bbd2817 to your computer and use it in GitHub Desktop.
[Medium] Prevent Annoying Template Caching in AngularJS 1.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) { | |
if (target === 'dist') { | |
return grunt.task.run(['build', 'connect:dist:keepalive']); | |
} | |
grunt.task.run([ | |
'gitinfo', | |
'clean:server', | |
'ngconstant', | |
... | |
]); | |
}); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt, options) { | |
var buildEnvironment = grunt.config('env'); | |
return { | |
options: { | |
name: 'ngConstantEnv', | |
dest: '.tmp/scripts/env.js' | |
}, | |
// Environment targets | |
environment: { | |
wrap: '"use strict";\n\n <%= __ngModule %>', | |
constants: { | |
ENV: { | |
name: buildEnvironment, | |
baseUrl: require('../app.json')[buildEnvironment]['baseUrl'], | |
version: require('../package.json').version, | |
build: '<%= new Date(gitinfo.local.branch.current.lastCommitTime).getTime() %>' | |
} | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment