我正在尝试获取一个 gulp 监视任务(在保存时编译 TypeScript 文件)以使用 ProjectOpen 绑定运行 - 但它在项目打开时不会启动。
如果我在任务运行程序资源管理器中手动启动它,它工作正常。
我正在使用 ASP.NET 核心项目 (RC2),是否有任何 nuget 包或设置必须存在才能运行项目打开的 gulp 任务?
或者一种调试为什么它不启动的方法?
package.json:
{
"version": "1.0.0",
"name": "demo-website",
"private": true,
"devDependencies": {
"gulp": "3.9.1",
"gulp-merge": "0.1.1",
"gulp-sourcemaps": "1.6.0",
"gulp-typescript": "2.13.4",
"jspm": "0.16.34",
"typescript": "1.8.10",
"typings": "^1.0.4"
},
"dependencies": { },
"jspm": {
"directories": {
"baseURL": "wwwroot"
},
"dependencies": {
"bootstrap": "github:twbs/bootstrap@^3.3.6",
"css": "github:systemjs/plugin-css@^0.1.21"
},
"devDependencies": { }
}
}
gulpfile.js:
/// <binding BeforeBuild='ts-compile' ProjectOpened='watch-files' />
var gulp = require("gulp"),
ts = require("gulp-typescript"),
merge = require("gulp-merge"),
sourcemaps = require("gulp-sourcemaps");
var webroot = "./wwwroot/";
var paths = {
tsSource: "./TypeScript/**/*.ts",
tsOutput: webroot + "compiled/"
};
var tsConfig = ts.createProject("tsconfig.json");
gulp.task("default", function () {
// place code for your default task here
});
gulp.task("ts-compile", function () {
return gulp.src([paths.tsSource, "./typings/index.d.ts"])
.pipe(sourcemaps.init())
.pipe(ts(tsConfig))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.tsOutput));
});
gulp.task("watch-files", function () {
gulp.watch(paths.tsSource, ["ts-compile"]);
});
这
似乎是RC2(工具预览版1)的工具错误。 看起来它将在预览版 2 中修复。
https://github.com/aspnet/Tooling/issues/516