Skip to content

Compile on change with gulp #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions src/aspnetcore-angular2-seed/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
var gulp = require('gulp'),
var paths = {
tsSource: './scripts/*.ts',
tsOutput: './wwwroot/app/'
};

var gulp = require('gulp'),
rimraf = require('rimraf'),
merge = require('merge'),
ts = require('gulp-typescript');

var gulp = require('gulp'),
Q = require('q'),
rimraf = require('rimraf');

Expand Down Expand Up @@ -31,4 +41,18 @@ gulp.task('copy:lib', ['clean'], function () {
});

return Q.all(promises);
});
});

var tsProject = ts.createProject('./scripts/tsconfig.json');
var util = require("gulp-util");

gulp.task('ts-compile', function () {
var tsResult = gulp.src(paths.tsSource)
.pipe(ts(tsProject));
return merge([tsResult.js.pipe(gulp.dest(paths.tsOutput))]);
});

// Link this to the "opening of the project" and you ll get a compile on change.
gulp.task('watch', ['ts-compile'], function () {
gulp.watch(paths.tsSource, ['ts-compile']);
});