我使用Angular 2.我想禁用/删除浏览器同步。但无法找到如何做到,或通过cmd或代码?哪条路? 需要帮助)
版本角度2.0.0-rc.1"
"Projest structure:
-Build/
-NodeModules/
-SRC/
-Typings/
-gunlpfile.ts
-bsconfig.json
-tsconfig.json
-tslint.json
-typings.json"
这是gulpfile.ts:
"use strict";
const gulp = require("gulp");
const del = require("del");
const sass = require('gulp-sass');
const tsc = require("gulp-typescript");
const sourcemaps = require('gulp-sourcemaps');
const tsProject = tsc.createProject("tsconfig.json");
const tslint = require('gulp-tslint');
gulp.task('clean', (cb) => {
return del(["build"], cb);
});
继续
gulp.task('tslint', () => {
return gulp.src("src/**/*.ts")
.pipe(tslint())
.pipe(tslint.report('prose'));
});
gulp.task("compile", ["tslint"], () => {
let tsResult = gulp.src("src/**/*.ts")
.pipe(sourcemaps.init())
.pipe(tsc(tsProject))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest("build"));
});
gulp.task("sass", () => {
return gulp.src("src/**/*.{sass,scss}")
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest("build"));
});
gulp.task("resources", () => {
return gulp.src(["src/**/*", "!**/*.{sass,scss,ts}"])
.pipe(sourcemaps.write())
.pipe(gulp.dest("build"));
});
这是gulpfile.ts的一部分
答案 0 :(得分:0)
如果您使用Angular2-Seed项目,请查看seed.config.ts
/**
* Configurations for NPM module configurations. Add to or override in project.config.ts.
* If you like, use the mergeObject() method to assist with this.
*/
PLUGIN_CONFIGS: any = {
/**
* The BrowserSync configuration of the application.
* The default open behavior is to open the browser. To prevent the browser from opening use the `--b` flag when
* running `npm start` (tested with serve.dev).
* Example: `npm start -- --b`
* @type {any}
*/
'browser-sync': {
middleware: [require('connect-history-api-fallback')({ index: `${this.APP_BASE}index.html` })],
port: this.PORT,
startPath: this.APP_BASE,
open: argv['b'] ? false : true,
injectChanges: false,
server: {
baseDir: `${this.DIST_DIR}/empty/`,
routes: {
[`${this.APP_BASE}${this.APP_DEST}`]: this.APP_DEST,
[`${this.APP_BASE}node_modules`]: 'node_modules',
[`${this.APP_BASE.replace(/\/$/, '')}`]: this.APP_DEST
}
}
}
};