本文整理汇总了TypeScript中gulp-typescript类的典型用法代码示例。如果您正苦于以下问题:TypeScript gulp-typescript类的具体用法?TypeScript gulp-typescript怎么用?TypeScript gulp-typescript使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了gulp-typescript类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
gulp.task("build.js", () => {
return gulp.src(tsSources.concat("./typings/index.d.ts"), { base: "."})
.pipe(sourcemaps.init())
.pipe(ts(tsProject))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest("."));
});
示例2: build
function build(path: string[]): Promise<any> {
// TODO: remove this if it every works in watch mode without needing to re-create.
let project = gulpTs.createProject('tsconfig.json', {
typescript: require('typescript'),
rootDir: 'modules'
});
let output = gulp.src(path)
.pipe(gulpTs(project));
// Using a promise instead of merging streams since end
// event on streams seems not to be propagated when merged.
return new Promise((resolve) => {
var doneCount = 0;
output.js
.pipe(rename(buildUtils.stripSrcFromPath))
.pipe(gulp.dest('dist'))
.on('end', maybeDone),
output.dts
.pipe(rename(buildUtils.stripSrcFromPath))
.pipe(gulp.dest('dist'))
.on('end', maybeDone)
function maybeDone() {
doneCount++;
if (doneCount == 2) resolve();
}
})
}
示例3: typescriptTask
export function typescriptTask(enableSourcemaps: boolean = false) {
let files = [`${DIR_SRC}/**/*.ts`, 'typings/browser/**/*.d.ts'];
return gulp.src(files, {base: DIR_SRC})
.pipe(gulpif(enableSourcemaps, sourcemaps.init()))
.pipe(typescript(project))
.pipe(gulpif(enableSourcemaps, sourcemaps.write()))
.pipe(gulp.dest(DIR_TMP));
}
示例4:
@Task('ts::compile')
src() {
let tsResult = this.tsProject.src()
.pipe(ts(this.tsProject));
return tsResult.js
.pipe(gulp.dest('./dist'))
.pipe(debug());
}
示例5:
gulp.task('compile', () => {
const tsResult = gulp.src(paths.src + '/' + paths.ts)
.pipe(sourcemaps.init())
.pipe(ts(tsProject));
return tsResult.js
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.build));
});
示例6:
gulp.task('script', () => {
let tsProject = tsc.createProject('tsconfig.json');
return tsProject
.src()
.pipe(sourcemaps.init())
.pipe(tsc(tsProject))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});
示例7:
gulp.task('compile-typescript', () => {
let customOpts = { module: 'system', moduleResolution: 'node' };
let tsProject = typescript.createProject('tsconfig.json', customOpts);
gulp
.src(SCRIPTS_SRC)
.pipe(changed(APP_DEST))
.pipe(typescript(tsProject))
.pipe(gulp.dest(APP_DEST))
.pipe(browserSync.stream());
});
示例8: merge
gulp.task("build.src", () => {
var tsResult = gulp.src(["./typings/index.d.ts"].concat(source, specFilesNegate), { base: "./src"})
.pipe(inlineNg2Template({ useRelativePaths: true, base: "/src/*"}))
.pipe(sourcemaps.init())
.pipe(ts(tsProdProject));
return merge(
tsResult.js.pipe(sourcemaps.write()).pipe(gulp.dest("./igniteui-js-blocks")),
tsResult.dts.pipe(gulp.dest("./igniteui-js-blocks"))
);
});
示例9: compileJs
function compileJs(src: string[], dest: string, inlineTpl?: boolean): NodeJS.ReadWriteStream {
const result = gulp.src(['./tools/typings/tsd/tsd.d.ts', './tools/typings/*.ts'].concat(src))
.pipe(plumber())
.pipe(sourcemaps.init());
return result
.pipe(typescript(tsProject)).js
.pipe(ngAnnotate())
.pipe(sourcemaps.write())
.pipe(gulp.dest(dest));
}
示例10: function
gulp.task('tsc', function() {
const tsProject = ts.createProject('server.json', {
typescript : require('typescript')
});
const tsResult = gulp.src(['public/javascripts/*.ts', 'routes/*.ts'])//tsProject.src()
.pipe(ts(tsProject))
.pipe(gulp.dest(function(file) {
return file.base;
}));
// .on('error', gutil.log);
return tsResult;
});