2015-10-03 11:54:09 +03:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var runSequence = require('run-sequence');
|
|
|
|
var Builder = require('systemjs-builder');
|
2015-10-03 12:50:35 +03:00
|
|
|
var inlineNg2Template = require('gulp-inline-ng2-template');
|
2015-10-03 11:54:09 +03:00
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
var paths = require('../paths');
|
2015-10-03 12:50:35 +03:00
|
|
|
var fs= require('fs');
|
2015-10-03 11:54:09 +03:00
|
|
|
|
|
|
|
gulp.task('build', function (callback) {
|
|
|
|
return runSequence(
|
|
|
|
'clean',
|
2015-10-03 12:50:35 +03:00
|
|
|
'bundleSfx',
|
2015-10-03 11:54:09 +03:00
|
|
|
callback
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2015-10-03 12:50:35 +03:00
|
|
|
gulp.task('inlineTemplates', function() {
|
|
|
|
return gulp.src(paths.source, { base: './' })
|
|
|
|
.pipe(inlineNg2Template({ base: '/' }))
|
|
|
|
.pipe(gulp.dest(paths.tmp));
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('bundleSfx', ['inlineTemplates'], function(cb) {
|
2015-10-03 11:54:09 +03:00
|
|
|
var builder = new Builder('./', 'system.config.js');
|
|
|
|
builder
|
2015-10-03 12:50:35 +03:00
|
|
|
.buildStatic(path.join(paths.tmp, paths.sourceEntryPoint),
|
|
|
|
path.join(paths.output, 'redoc.full.js'),
|
2015-10-07 10:18:02 +03:00
|
|
|
{ globalName: 'Redoc', sourceMaps: true }
|
|
|
|
)
|
2015-10-03 11:54:09 +03:00
|
|
|
.then(function() {
|
|
|
|
cb();
|
|
|
|
})
|
|
|
|
.catch(function(err) {
|
|
|
|
cb(new Error(err));
|
|
|
|
});
|
|
|
|
});
|