Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
`grunt-string-replace` in action
angular
.module('app', [
'appDev', // <-- this line will be removed.*
'ngCookies',
'ngSanitize',
'ui.router',
'angularLocalStorage',
'btford.modal',
'reCAPTCHA'
]);
/*
* `appDev` is a module delcared in a file, "app-dev.js". If you look in
* `index.html`, you'll see a reference to this file between a `<!-- remove -->`
* block. That block is removed by `grunt-string-replace`.
*/
module.exports = function (grunt) {
grunt.initConfig({
'string-replace': {
dist: {
files: {
'.tmp/concat/scripts/app.js': ['.tmp/concat/scripts/app.js'],
'<%= yeoman.dist %>/index.html': ['<%= yeoman.dist %>/index.html']
},
options: {
replacements: [
{
pattern: /['"]appDev['"],*/gi,
replacement: ''
},
{
pattern: /[\s\t]*<!--\s*remove\s*-->(\n|\r|.)*?(<!--\s*endremove\s*-->)/gi,
replacement: ''
}
]
}
}
}
});
};
<html>
<body>
<!-- build:js /scripts/vendor.js -->
<!-- bower:js -->
<script src="/bower_components/jquery/dist/jquery.js"></script>
<script src="/bower_components/angular/angular.js"></script>
<script src="/bower_components/angular-cookies/angular-cookies.js"></script>
<script src="/bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="/bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script src="/bower_components/angularLocalStorage/src/angularLocalStorage.js"></script>
<script src="/bower_components/angular-modal/modal.js"></script>
<!-- endbower -->
<script src="/bower_components/angular-re-captcha/angular-re-captcha.js"></script>
<!-- endbuild -->
<!-- remove -->
<script src="/bower_components/angular-mocks/angular-mocks.js"></script>
<script src="/scripts/app-dev.js"></script>
<!-- endremove -->
<!-- build:js({.tmp,app}) /scripts/app.js -->
<script src="/scripts/app.js"></script>
<!-- endbuild -->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.