Fix console output of the Watch
task
This commit is contained in:
parent
4d07cfac76
commit
8369fa4949
1 changed files with 47 additions and 33 deletions
80
gulpfile.ts
80
gulpfile.ts
|
@ -3,7 +3,7 @@ import GulpClient, { TaskFunction } from "gulp";
|
||||||
import path from "upath";
|
import path from "upath";
|
||||||
import { Context } from "./gulp/Context.js";
|
import { Context } from "./gulp/Context.js";
|
||||||
|
|
||||||
const { dest, parallel, series, src, watch } = GulpClient;
|
const { dest, parallel, series, src, task, watch } = GulpClient;
|
||||||
const { join } = path;
|
const { join } = path;
|
||||||
|
|
||||||
const context = new Context();
|
const context = new Context();
|
||||||
|
@ -119,38 +119,52 @@ function BrowserSync(syncer: BrowserSyncInstance, filePath?: string): TaskFuncti
|
||||||
/**
|
/**
|
||||||
* Builds and watches the files for changes.
|
* Builds and watches the files for changes.
|
||||||
*/
|
*/
|
||||||
export function Watch(): void
|
export let Watch: TaskFunction = async (): Promise<void> =>
|
||||||
{
|
{
|
||||||
let syncer = browserSync.create();
|
return new Promise<void>(
|
||||||
Build();
|
(resolve, reject) =>
|
||||||
|
{
|
||||||
|
series(Build)(
|
||||||
|
(error) =>
|
||||||
|
{
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
let syncer = browserSync.create();
|
||||||
|
|
||||||
syncer.init({
|
syncer.init({
|
||||||
open: false,
|
open: false,
|
||||||
server: context.StaticPath(),
|
server: context.StaticPath(),
|
||||||
online: false
|
online: false
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
context.SourcePath(context.JSDirName),
|
context.SourcePath(context.JSDirName),
|
||||||
series(
|
series(
|
||||||
JavaScript,
|
JavaScript,
|
||||||
BrowserSync(syncer, "*.js")));
|
BrowserSync(syncer, "*.js")));
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
context.SourcePath(context.StyleDirName, "**", "*.css"),
|
context.SourcePath(context.StyleDirName, "**", "*.css"),
|
||||||
series(
|
series(
|
||||||
Styles,
|
Styles,
|
||||||
BrowserSync(syncer, "*.css")));
|
BrowserSync(syncer, "*.css")));
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
context.SourcePath(context.AssetDirName),
|
context.SourcePath(context.AssetDirName),
|
||||||
series(
|
series(
|
||||||
Assets,
|
Assets,
|
||||||
BrowserSync(syncer, join(context.AssetDirName, "**", "*"))));
|
BrowserSync(syncer, join(context.AssetDirName, "**", "*"))));
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
context.SourcePath("**", "*.html"),
|
context.SourcePath("**", "*.html"),
|
||||||
series(
|
series(
|
||||||
WebPages,
|
WebPages,
|
||||||
BrowserSync(syncer, "*.html")));
|
BrowserSync(syncer, "*.html")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue