Reputation: 3979
Required steps
clean build
directory.compile typescript files
then put compiled files in to build directory.inject compiled files
as script to index.html then put it to build directory.Project structure
-- build
-- src
--app
--app.ts
..
-- index.html
index.html
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<!-- inject:js -->
<!-- endinject -->
</body>
</html>
Gulp tasks
"devDependencies": {
"del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-inject": "^3.0.0",
"gulp-typescript": "^2.10.0",
"run-sequence": "^1.1.5"
}
gulp.task('clean', function() {
return del('build');
});
gulp.task('ts', funtion() {
var tsProject = ts.createProject('tsconfig.json');
return tsProject.src('src/**/*.ts')
.pipe(ts(tsProject))
.js.pipe(gulp.dest('build'));
});
gulp.task('inject', funtion() {
return gulp.src('index.html')
.pipe(inject(gulp.src('build/**/*.js', {read: false}), {ignorePath: 'build', relative: true}))
.pipe(gulp.dest('build'));
});
gulp.task('build', function() {
runSequence('clean', 'ts', 'inject');
});
Problem
When I execute gulp ts && gulp inject
it works perfectly.
When I excute gulp build
the inject
doesn't work with no message print out.
I think there are problems with run-sequence. Could you please help me to figure out the problems and how to solve it?
Upvotes: 2
Views: 352
Reputation: 3979
After several hours of digging, I realized that when a task returns an in-appropriate stream, run-sequence stops running with no warning or error. Hope this will help anyone else who have the same issue.
Upvotes: 1