-
-
Save stephenplusplus/523314c4bdda1a8ad1c0 to your computer and use it in GitHub Desktop.
`grunt-string-replace` in action
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
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`. | |
*/ |
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) { | |
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: '' | |
} | |
] | |
} | |
} | |
} | |
}); | |
}; |
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
<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