https://github.com/born2net/gulp-comment-swap
https://github.com/born2net/gulp-comment-swap
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/born2net/gulp-comment-swap
- Owner: born2net
- Created: 2016-02-03T02:28:14.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-22T15:35:54.000Z (over 9 years ago)
- Last Synced: 2025-06-04T22:01:00.615Z (about 1 year ago)
- Language: JavaScript
- Size: 154 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
gulp-comment-swap
===============
Swap lines with comment in and out if they match regexp
-------------
Sample: comment out all typescript files that contain /\*webpack\*/ and comment in all lines that have /\*systemjs\*/ (swap)
```
npm install gulp-comment-swap -save-dev
```
and usage:
```
gulp.task('dev', function (done) {
gulp.src('./src/**/*.ts')
.pipe(commentSwap(new RegExp('/\\*prod\\*/'),new RegExp('/\\*dev\\*/'))).on('error', function(err){
console.log('gulp-swap error: ' + err);
})
.pipe(gulp.dest('./src'));
done()
});
```
this is a great way to support both system.js and webpack with Angular2 for example:
```
**/
@Component({
// template: require('./App2.html'), /*webpack*/
templateUrl: '/src/comps/app2/App2.html', /*systemjs*/
providers: [HTTP_PROVIDERS],
directives: [ROUTER_DIRECTIVES, RouterLink, DividerPanel, Menu, MenuItem, Sliderpanel, Digg, Properties,
Notes, Notes1, Notes2, Notes3, Notes4, Notes5, Weather, Logout, Contact, ModalDialog]
})
export class App2 {
private screens:any;
private commBroker:CommBroker;
...
```
the Gulp with swap between the two packaging systems.
enjoy!