-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (40 loc) · 1.35 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
42
43
44
45
46
47
48
49
50
"use strict";
const { Command } = require("./");
const gulpCommand = new Command();
// Using custom RegExp when it's needed
const customSettings = {
regexOption: false, // Default is false
regexAlias: false,
regexArgument: false // Ex: /[0-9]/i
};
// Command definition
gulpCommand
.setting(customSettings)
.option("build", "-s", "--site", "Building styling for a specific site")
.subOption("build", "--site", "-m", "--minify", "Minify files in destination")
.subOption("build", "--site", "-o", "--overwrite", "Overwrite files in destination")
.option("build", "-t", "--move-to", "Move to new location")
.option("build", "-n", "--name", "Using a new file name");
// Using in a Gulp task
function build(cb) {
const result = gulpCommand.parse(process.argv.slice(2));
//console.log(gulpCommand.getOptions());
console.log(result);
if (result.site) {
if (result.site.minify) {
console.log("Minification task -> Done!");
}
if (result.site.overwrite) {
console.log("Overwriting task -> Done!");
}
} else {
console.log("Nothing to do");
}
cb();
}
exports.build = build;
/**
* Run the Gulp command for testing purpose
* gulp build -s -m -o FlowerSite
* gulp build --site --minify --overwrite FlowerSite --move-to "/home/dev" --name flowersite-v1.0.0
*/