Skip to content

Commit dcd2df2

Browse files
committed
build(gulp): add docs/angular.io/watch and docs/angular.io/copy tasks
1 parent 5f15363 commit dcd2df2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

gulpfile.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,32 @@ gulp.task('docs/angular.io', ['build/clean.docs_angular_io'], function() {
485485
}
486486
});
487487

488+
489+
gulp.task('docs/angular.io/watch', function() {
490+
watch(['modules/angular2/docs/**', 'modules/**/src/**'], ['docs/angular.io', 'docs/angular.io/copy']);
491+
});
492+
493+
494+
gulp.task('docs/angular.io/copy', function(){
495+
var DOCS_DIRS = ['core', 'http', 'lifecycle_hooks', 'router', 'test'];
496+
var DOCS_DIST = 'dist/angular.io/partials/api/angular2/';
497+
var DOCS_IO_DIST = '../angular.io/public/docs/js/latest/api/';
498+
499+
var fs = require('fs');
500+
var fse = require('fs-extra');
501+
502+
if (!fs.existsSync('../angular.io')) {
503+
throw new Error('docs/angular.io-watch task requires the angular.io repo to be at ' + path.resolve('../angular.io'));
504+
}
505+
506+
DOCS_DIRS.forEach(function(dir) {
507+
var distIODir = DOCS_IO_DIST + dir;
508+
fse.removeSync(distIODir);
509+
fse.copySync(DOCS_DIST + dir, DOCS_IO_DIST + dir);
510+
});
511+
});
512+
513+
488514
gulp.task('docs/typings', [], function() {
489515
try {
490516
var dgeni = new Dgeni([require('./docs/typescript-definition-package')]);

0 commit comments

Comments
 (0)