Added zone.js to build

This commit is contained in:
Roman Gotsiy 2015-10-14 23:59:39 +03:00
parent 624e2bfb2b
commit 99e515c2aa
4 changed files with 27 additions and 5 deletions

View File

@ -3,6 +3,7 @@ module.exports = {
html: 'lib/**/*.html',
css: 'lib/**/*.css',
sourceEntryPoint: 'lib/index.js',
outputName: 'redoc.full.js',
output: 'dist/',
tmp: '.tmp/',
demo: 'demo/**/*'

View File

@ -3,29 +3,46 @@ var runSequence = require('run-sequence');
var Builder = require('systemjs-builder');
var inlineNg2Template = require('gulp-inline-ng2-template');
var path = require('path');
var sourcemaps = require('gulp-sourcemaps');
var paths = require('../paths');
var fs= require('fs');
var concat = require('gulp-concat');
paths.redocBuilt = path.join(paths.output, paths.outputName);
gulp.task('build', function (callback) {
return runSequence(
'clean',
'bundleSfx',
'bundle',
callback
);
});
gulp.task('bundle', ['bundleSfx', 'concatDeps']);
gulp.task('inlineTemplates', function() {
return gulp.src(paths.source, { base: './' })
.pipe(inlineNg2Template({ base: '/' }))
.pipe(gulp.dest(paths.tmp));
});
var JS_DEV_DEPS = [
'node_modules/zone.js/dist/zone-microtask.js'
];
// concatenate angular2 deps
gulp.task('concatDeps', ['bundleSfx'], function() {
gulp.src(JS_DEV_DEPS.concat([paths.redocBuilt]))
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(concat(paths.outputName))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.output))
});
gulp.task('bundleSfx', ['inlineTemplates'], function(cb) {
var builder = new Builder('./', 'system.config.js');
builder
.buildStatic(path.join(paths.tmp, paths.sourceEntryPoint),
path.join(paths.output, 'redoc.full.js'),
paths.redocBuilt,
{ globalName: 'Redoc', sourceMaps: true }
)
.then(function() {

View File

@ -6,7 +6,7 @@ function changed(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
}
gulp.task('watch', ['build'], function () {
gulp.task('watch', ['bundle'], function () {
gulp.watch([ paths.source ], [ 'bundleSfx', browserSync.reload ]).on('change', changed);
gulp.watch([ paths.html ], [ 'bundleSfx', browserSync.reload]).on('change', changed);
gulp.watch([ paths.css ], [ 'bundleSfx', browserSync.reload]).on('change', changed);

View File

@ -41,14 +41,18 @@
"browser-sync": "^2.9.8",
"del": "^2.0.2",
"gulp": "^3.9.0",
"gulp-concat": "^2.6.0",
"gulp-eslint": "^1.0.0",
"gulp-inline-ng2-template": "0.0.7",
"gulp-jshint": "^1.11.2",
"gulp-replace": "^0.5.4",
"gulp-sourcemaps": "^1.6.0",
"jshint-stylish": "^2.0.1",
"jspm": "^0.16.11",
"require-dir": "^0.3.0",
"run-sequence": "^1.1.4",
"systemjs-builder": "^0.14.7",
"vinyl-paths": "^2.0.0"
"vinyl-paths": "^2.0.0",
"zone.js": "^0.5.8"
}
}