-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (35 loc) · 1 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const { watch, series } = require('gulp');
const connectPhp = require('gulp-connect-php');
const browserSync = require('browser-sync');
const chalk = require('chalk');
const run = require('gulp-shell').task;
function serve() {
const httpPort = 8080;
const connectPhpOptions = {
port: httpPort,
};
const browserSyncOptions = {
proxy: '127.0.0.1:' + httpPort,
port: 3080,
open: false,
notify: false,
};
connectPhp.server(connectPhpOptions, () => browserSync(browserSyncOptions));
watch('**/*.php').on('change', (file) => {
console.log("[" + chalk.yellow('watch') + "] `" + chalk.yellow.bold(file) + "` changed !");
browserSync.reload();
});
}
async function kahlan() {
run('composer test', { ignoreErrors: true })();
}
async function test() {
watch('spec/*.spec.php').on('change', (file) => {
console.log("[" + chalk.magenta('watch') + "] `" + chalk.magenta.bold(file) + "` changed !");
kahlan();
});
}
module.exports = {
serve,
test: series(kahlan, test),
};