@newlogic-digital/core 0.9.13 → 1.0.0-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +15 -45
- package/index.js +262 -43
- package/package.json +13 -58
- package/LICENSE +0 -674
- package/modules/Core.js +0 -626
- package/modules/Emails.js +0 -110
- package/modules/Icons.js +0 -140
- package/modules/Scripts.js +0 -321
- package/modules/Serve.js +0 -124
- package/modules/Styles.js +0 -298
- package/modules/Templates.js +0 -468
- package/modules/Utils.js +0 -299
- package/modules/Watch.js +0 -75
- package/modules/tailwind/index.cjs +0 -84
- package/modules/tailwind/index.js +0 -75
- package/packages/gulp-clean-css/LICENSE +0 -20
- package/packages/gulp-clean-css/README.md +0 -79
- package/packages/gulp-clean-css/index.js +0 -66
- package/packages/gulp-clean-css/package.json +0 -68
- package/packages/gulp-twig2html/CHANGELOG.md +0 -77
- package/packages/gulp-twig2html/LICENSE +0 -22
- package/packages/gulp-twig2html/README.md +0 -112
- package/packages/gulp-twig2html/index.js +0 -30
- package/packages/gulp-twig2html/package.json +0 -47
- package/packages/postcss-inset/CHANGELOG.md +0 -5
- package/packages/postcss-inset/LICENSE.md +0 -106
- package/packages/postcss-inset/README.md +0 -121
- package/packages/postcss-inset/index.cjs.js +0 -49
- package/packages/postcss-inset/index.es.mjs +0 -47
- package/packages/postcss-inset/index.js +0 -47
- package/packages/postcss-inset/package.json +0 -58
- package/packages/twig-renderer/CHANGELOG.md +0 -66
- package/packages/twig-renderer/LICENSE +0 -22
- package/packages/twig-renderer/README.md +0 -93
- package/packages/twig-renderer/package.json +0 -49
- package/packages/twig-renderer/twig-renderer.js +0 -90
package/modules/Core.js
DELETED
@@ -1,626 +0,0 @@
|
|
1
|
-
import lodash from "lodash";
|
2
|
-
import fs from "fs";
|
3
|
-
import lazypipe from "lazypipe";
|
4
|
-
import gulpif from "gulp-if";
|
5
|
-
import path from "path";
|
6
|
-
import nodeCmd from "child_process";
|
7
|
-
import https from "https";
|
8
|
-
import gulp from "gulp";
|
9
|
-
import through from "through2";
|
10
|
-
import {Utils} from "./Utils.js";
|
11
|
-
import {Templates} from "./Templates.js";
|
12
|
-
import {Styles} from "./Styles.js";
|
13
|
-
import {Scripts} from "./Scripts.js";
|
14
|
-
import {Serve} from "./Serve.js";
|
15
|
-
import {Icons} from "./Icons.js";
|
16
|
-
import {Emails} from "./Emails.js";
|
17
|
-
import {Watch} from "./Watch.js";
|
18
|
-
import chalk from "chalk";
|
19
|
-
|
20
|
-
import {createRequire} from "module";
|
21
|
-
const require = createRequire(import.meta.url);
|
22
|
-
const root = process.cwd() + "/";
|
23
|
-
|
24
|
-
let Exists;
|
25
|
-
let Modules;
|
26
|
-
let Functions;
|
27
|
-
let Package = require(root + "package.json");
|
28
|
-
let Config = {
|
29
|
-
lang: "cs",
|
30
|
-
local: false,
|
31
|
-
errors: true,
|
32
|
-
vite: false,
|
33
|
-
config: false,
|
34
|
-
sri: false,
|
35
|
-
serve: {
|
36
|
-
index: "/",
|
37
|
-
mode: "",
|
38
|
-
https: false,
|
39
|
-
cert: 'localhost',
|
40
|
-
reload: (file) => (file.endsWith('.php') || file.endsWith('.tpl') || file.endsWith('.latte')) && !file.includes('temp/'),
|
41
|
-
vite: {}
|
42
|
-
},
|
43
|
-
modules: {},
|
44
|
-
paths: {
|
45
|
-
temp: "temp",
|
46
|
-
cdn: "temp/cdn",
|
47
|
-
base: "",
|
48
|
-
input: {
|
49
|
-
root: "src",
|
50
|
-
main: "src/main.json",
|
51
|
-
templates: "src/templates",
|
52
|
-
scripts: "src/scripts",
|
53
|
-
styles: "src/styles",
|
54
|
-
icons: "src/icons",
|
55
|
-
emails: "src/emails",
|
56
|
-
assets: "src/assets"
|
57
|
-
},
|
58
|
-
output: {
|
59
|
-
rewrite: true,
|
60
|
-
root: "public",
|
61
|
-
scripts: "public/assets/js",
|
62
|
-
styles: "public/assets/css",
|
63
|
-
icons: "public/assets/css",
|
64
|
-
emails: "public",
|
65
|
-
emailsImg: "public/img",
|
66
|
-
emailsWww: "app/Presenters/emails",
|
67
|
-
assets: "public/assets"
|
68
|
-
}
|
69
|
-
},
|
70
|
-
icons: {
|
71
|
-
format: "css",
|
72
|
-
filename: "iconfont",
|
73
|
-
id: "",
|
74
|
-
local: false,
|
75
|
-
revision: true,
|
76
|
-
optimizations: true,
|
77
|
-
postcss: {}
|
78
|
-
},
|
79
|
-
scripts: {
|
80
|
-
optimizations: true,
|
81
|
-
revision: true,
|
82
|
-
legacy: false,
|
83
|
-
concat: [],
|
84
|
-
cdnPath: "Utils/cdn.js",
|
85
|
-
polyfillUrls: [],
|
86
|
-
polyfillFeatures: "default",
|
87
|
-
importResolution: {
|
88
|
-
subDir: false,
|
89
|
-
directories: [],
|
90
|
-
filename: "+.js"
|
91
|
-
},
|
92
|
-
importMap: {
|
93
|
-
build: true,
|
94
|
-
cdn: "esm.sh",
|
95
|
-
version: "v41",
|
96
|
-
target: "es2020",
|
97
|
-
trailingSlashes: "",
|
98
|
-
shortUrl: false,
|
99
|
-
localDownload: false
|
100
|
-
}
|
101
|
-
},
|
102
|
-
styles: {
|
103
|
-
format: "css",
|
104
|
-
revision: true,
|
105
|
-
optimizations: true,
|
106
|
-
clean: {},
|
107
|
-
purge: {
|
108
|
-
enabled: true,
|
109
|
-
content: [],
|
110
|
-
docs: false,
|
111
|
-
clean: {},
|
112
|
-
options: {},
|
113
|
-
nodeResolve: true,
|
114
|
-
nodeResolveIgnore: []
|
115
|
-
},
|
116
|
-
vendor: {
|
117
|
-
cache: false,
|
118
|
-
path: ""
|
119
|
-
},
|
120
|
-
importResolution: {
|
121
|
-
subDir: true,
|
122
|
-
directories: [],
|
123
|
-
filename: "+.css",
|
124
|
-
},
|
125
|
-
import: ['all'],
|
126
|
-
themePath: "",
|
127
|
-
ratio: {
|
128
|
-
enabled: false,
|
129
|
-
content: [],
|
130
|
-
files: ["main.css"]
|
131
|
-
},
|
132
|
-
join: {"main.css": ["temp/tailwind.css"]},
|
133
|
-
tailwind: {
|
134
|
-
cache: true,
|
135
|
-
postcss: {},
|
136
|
-
basename: "tailwind.css"
|
137
|
-
},
|
138
|
-
postcss: {}
|
139
|
-
},
|
140
|
-
templates: {
|
141
|
-
format: "twig",
|
142
|
-
layout: "",
|
143
|
-
placeholder: {
|
144
|
-
webp: true,
|
145
|
-
picsum: false,
|
146
|
-
lorempixel: ""
|
147
|
-
},
|
148
|
-
filters: {},
|
149
|
-
functions: {},
|
150
|
-
tags: []
|
151
|
-
},
|
152
|
-
emails: {
|
153
|
-
removeClasses: false,
|
154
|
-
inlineOnly: false,
|
155
|
-
zipPrefix: ["email"],
|
156
|
-
postcss: {},
|
157
|
-
format: "twig"
|
158
|
-
},
|
159
|
-
assets: {
|
160
|
-
revision: true
|
161
|
-
},
|
162
|
-
tailwind: {}
|
163
|
-
}
|
164
|
-
|
165
|
-
class Core {
|
166
|
-
init(ExtendConfig = {}) {
|
167
|
-
Config = lodash.merge(Config, ExtendConfig);
|
168
|
-
|
169
|
-
if (Config.config) {
|
170
|
-
fs.writeFileSync(`${root + Config.paths.output.root}/config.json`, JSON.stringify(Config));
|
171
|
-
}
|
172
|
-
|
173
|
-
if (!fs.existsSync(root + Config.paths.temp)){
|
174
|
-
fs.mkdirSync(root + Config.paths.temp);
|
175
|
-
}
|
176
|
-
|
177
|
-
Exists = {
|
178
|
-
scripts: fs.existsSync(root + Config.paths.input.scripts),
|
179
|
-
styles: fs.existsSync(root + Config.paths.input.styles),
|
180
|
-
icons: fs.existsSync(root + Config.paths.input.icons),
|
181
|
-
emails: fs.existsSync(root + Config.paths.input.emails),
|
182
|
-
assets: fs.existsSync(root + Config.paths.input.assets),
|
183
|
-
templates: fs.existsSync(root + Config.paths.input.templates) && !Config.vite,
|
184
|
-
postcssConfig: fs.existsSync(root + "postcss.config.cjs") || fs.existsSync(root + "postcss.config.js"),
|
185
|
-
tailwindConfig: fs.existsSync(root + "tailwind.config.cjs") || fs.existsSync(root + "tailwind.config.js")
|
186
|
-
}
|
187
|
-
|
188
|
-
Modules = {
|
189
|
-
hbs: {
|
190
|
-
module: (partials, helpers, data = {}) => {
|
191
|
-
let hbs = through.obj((file, enc, cb) => {
|
192
|
-
file.extname === ".hbs" && console.error("\x1b[31m", `Module gulp-hb is missing, ${file.basename} won't be compiled.`, "\x1b[0m");
|
193
|
-
cb(null, file);
|
194
|
-
});
|
195
|
-
|
196
|
-
try { hbs = require("gulp-hb")().partials(partials).helpers(helpers).data(data) } catch {}
|
197
|
-
|
198
|
-
return hbs
|
199
|
-
},
|
200
|
-
helpers: (helpers) => {
|
201
|
-
if (typeof helpers === "undefined") {
|
202
|
-
helpers = {};
|
203
|
-
}
|
204
|
-
|
205
|
-
if (typeof Config.modules.hbs !== "undefined") {
|
206
|
-
helpers = Object.assign(helpers, new Config.modules.hbs().helpers);
|
207
|
-
}
|
208
|
-
|
209
|
-
return helpers;
|
210
|
-
}
|
211
|
-
},
|
212
|
-
less: {
|
213
|
-
module: () => {
|
214
|
-
let less = through.obj((file, enc, cb) => {
|
215
|
-
file.extname === ".less" && console.error("\x1b[31m", `Module gulp-less is missing, ${file.basename} won't be compiled.`, "\x1b[0m");
|
216
|
-
cb(null, file);
|
217
|
-
});
|
218
|
-
|
219
|
-
try {less = require("gulp-less")()} catch {}
|
220
|
-
|
221
|
-
return less
|
222
|
-
}
|
223
|
-
},
|
224
|
-
autoprefixer: {
|
225
|
-
module() {
|
226
|
-
let autoprefixer = through.obj((file, enc, cb) => {
|
227
|
-
file.extname === ".less" && console.error("\x1b[31m", `Module gulp-autoprefixer is missing, ${file.basename} won't be compiled.`, "\x1b[0m");
|
228
|
-
cb(null, file);
|
229
|
-
});
|
230
|
-
|
231
|
-
try {autoprefixer = require("gulp-autoprefixer")()} catch {}
|
232
|
-
|
233
|
-
return autoprefixer;
|
234
|
-
},
|
235
|
-
pipe: lazypipe().pipe(() => gulpif((file) => {
|
236
|
-
return file.extname === ".less" && Config.styles.optimizations
|
237
|
-
}, Modules.autoprefixer.module({overrideBrowserslist: ['ie >= 11', 'last 2 versions']})))
|
238
|
-
}
|
239
|
-
}
|
240
|
-
|
241
|
-
Functions = {
|
242
|
-
stripIndent: (string) => {
|
243
|
-
const indent = () => {
|
244
|
-
const match = string.match(/^[ \t]*(?=\S)/gm);
|
245
|
-
|
246
|
-
if (!match) {
|
247
|
-
return 0;
|
248
|
-
}
|
249
|
-
|
250
|
-
return match.reduce((r, a) => Math.min(r, a.length), Infinity);
|
251
|
-
};
|
252
|
-
|
253
|
-
if (indent() === 0) {
|
254
|
-
return string;
|
255
|
-
}
|
256
|
-
|
257
|
-
const regex = new RegExp(`^[ \\t]{${indent()}}`, 'gm');
|
258
|
-
|
259
|
-
return string.replace(regex, '');
|
260
|
-
},
|
261
|
-
plumber: {
|
262
|
-
errorHandler(err) {
|
263
|
-
console.log("\x1b[31m", err.toString(), "\x1b[0m");
|
264
|
-
if (Config.errors) {
|
265
|
-
process.exit(-1);
|
266
|
-
} else {
|
267
|
-
this.emit('end');
|
268
|
-
}
|
269
|
-
}
|
270
|
-
},
|
271
|
-
revUpdate: (cleanup, cleanupDir) => {
|
272
|
-
return through.obj((file, enc, cb) => {
|
273
|
-
if (typeof file.revOrigPath === "undefined") {
|
274
|
-
cb(null, file);
|
275
|
-
return false;
|
276
|
-
}
|
277
|
-
|
278
|
-
let directory = path.parse(path.relative(process.cwd(), file.path)).dir.replace(Config.paths.input[cleanupDir], Config.paths.output[cleanupDir])
|
279
|
-
|
280
|
-
if (cleanup) {
|
281
|
-
let fileName = path.basename(file.revOrigPath).replace(path.extname(file.revOrigPath),"");
|
282
|
-
if (fs.existsSync(directory)) {
|
283
|
-
let files = fs.readdirSync(directory);
|
284
|
-
|
285
|
-
for (const file of files) {
|
286
|
-
let fileRev = file.replace(".min.",".").replace(path.extname(file),"");
|
287
|
-
|
288
|
-
if (fileRev.substr(0, fileRev.lastIndexOf('.')).indexOf(fileName) > -1 && fileRev.substr(0, fileRev.lastIndexOf('.')).length === fileName.length) {
|
289
|
-
fs.unlinkSync(path.join(directory, file));
|
290
|
-
}
|
291
|
-
}
|
292
|
-
}
|
293
|
-
}
|
294
|
-
|
295
|
-
function modify(pth, modifier) {
|
296
|
-
return path.join(path.dirname(pth), modifier(path.basename(pth, path.extname(pth)), path.extname(pth)));
|
297
|
-
}
|
298
|
-
|
299
|
-
file.path = modify(file.revOrigPath, function (name, ext) {
|
300
|
-
return name + '.' + file.revHash + ext;
|
301
|
-
});
|
302
|
-
|
303
|
-
cb(null, file);
|
304
|
-
})
|
305
|
-
},
|
306
|
-
execSync: (cmd) => nodeCmd.execSync(cmd, {stdio:[0,1,2]}),
|
307
|
-
download: (url, dest) => {
|
308
|
-
return new Promise((resolve, reject) => {
|
309
|
-
https.get(url, response => {
|
310
|
-
if (response.statusCode === 200) {
|
311
|
-
response.pipe(fs.createWriteStream(dest));
|
312
|
-
response.on("end", resolve)
|
313
|
-
} else {
|
314
|
-
console.error("\x1b[31m", `Error: ${url} returns ${response.statusCode}`, "\x1b[0m");
|
315
|
-
reject()
|
316
|
-
}
|
317
|
-
});
|
318
|
-
})
|
319
|
-
},
|
320
|
-
revRewriteOutput: () => {
|
321
|
-
return through.obj((file, enc, cb) => {
|
322
|
-
if (file.isNull()) {
|
323
|
-
cb(null, file);
|
324
|
-
}
|
325
|
-
if (file.isBuffer()) {
|
326
|
-
let contents = file.contents.toString();
|
327
|
-
|
328
|
-
contents = contents.replace(new RegExp(`${Config.paths.input.assets}`, 'g'),
|
329
|
-
`${Config.paths.output.assets.replace(Config.paths.output.root + "/", Config.paths.base.length > 0 ? Config.paths.base + "/" : "")}`)
|
330
|
-
|
331
|
-
file.contents = Buffer.from(contents);
|
332
|
-
|
333
|
-
cb(null, file);
|
334
|
-
}
|
335
|
-
});
|
336
|
-
},
|
337
|
-
module: (name, options = {}) => {
|
338
|
-
let module = through.obj((file, enc, cb) => {
|
339
|
-
console.error("\x1b[31m", `Module ${name} is missing, ${file.basename} won't be compiled.`, "\x1b[0m");
|
340
|
-
cb(null, file);
|
341
|
-
});
|
342
|
-
|
343
|
-
try {module = require(name)(options)} catch {}
|
344
|
-
|
345
|
-
return module;
|
346
|
-
},
|
347
|
-
serverReload: () => {
|
348
|
-
if (typeof Serve.server !== "undefined") {
|
349
|
-
Serve.server.ws.send({
|
350
|
-
type: 'full-reload',
|
351
|
-
path: '*',
|
352
|
-
});
|
353
|
-
Serve.server.config.logger.info(
|
354
|
-
chalk.green(`page reload `) + chalk.dim(`${Config.paths.output.root}/*.html`),
|
355
|
-
{ clear: true, timestamp: true }
|
356
|
-
)
|
357
|
-
}
|
358
|
-
}
|
359
|
-
}
|
360
|
-
|
361
|
-
if (Config.styles.ratio.enabled && Config.styles.ratio.content.length === 0 && Exists.templates) {
|
362
|
-
Config.styles.ratio.content.push(`${root + Config.paths.input.templates}/**/*.{hbs,html,twig}`);
|
363
|
-
}
|
364
|
-
|
365
|
-
if (Config.styles.purge.content.length === 0 && Exists.styles) {
|
366
|
-
Exists.scripts && Config.styles.purge.content.push(`${Config.paths.input.scripts}/**/*.js`);
|
367
|
-
Exists.templates && Config.styles.purge.content.push(`${Config.paths.input.templates}/**/*.twig`);
|
368
|
-
|
369
|
-
Config.styles.purge.content.push(`${Config.paths.cdn}/*.js`)
|
370
|
-
}
|
371
|
-
|
372
|
-
this.tasks();
|
373
|
-
|
374
|
-
return Config;
|
375
|
-
}
|
376
|
-
tasks() {
|
377
|
-
if (!Config.vite) {
|
378
|
-
(Exists.assets || Exists.icons || Exists.styles || Exists.scripts || Exists.templates)
|
379
|
-
&& gulp.task("default", resolve => {
|
380
|
-
let tasks = [];
|
381
|
-
|
382
|
-
!Config.local && tasks.push("cleanup", "cdn");
|
383
|
-
Exists.assets && tasks.push("assets:production")
|
384
|
-
Exists.icons && tasks.push("icons:production")
|
385
|
-
Exists.styles && tasks.push("styles:production")
|
386
|
-
Exists.scripts && tasks.push("scripts:production")
|
387
|
-
Exists.templates && tasks.push("templates:production")
|
388
|
-
|
389
|
-
Config.errors = true
|
390
|
-
|
391
|
-
gulp.series(tasks)(resolve)
|
392
|
-
});
|
393
|
-
|
394
|
-
(Exists.assets || Exists.icons || Exists.styles || Exists.scripts)
|
395
|
-
&& gulp.task("production", resolve => {
|
396
|
-
let tasks = [];
|
397
|
-
|
398
|
-
!Config.local && tasks.push("cleanup", "cdn");
|
399
|
-
Exists.assets && tasks.push("assets:production")
|
400
|
-
Exists.icons && tasks.push("icons:production")
|
401
|
-
Exists.styles && tasks.push("styles:production")
|
402
|
-
Exists.scripts && tasks.push("scripts:production")
|
403
|
-
|
404
|
-
Config.errors = true
|
405
|
-
Config.styles.purge.docs = true
|
406
|
-
|
407
|
-
gulp.series(tasks)(resolve)
|
408
|
-
});
|
409
|
-
|
410
|
-
gulp.task("cleanup", () => {
|
411
|
-
return new Utils().cleanup()
|
412
|
-
})
|
413
|
-
|
414
|
-
gulp.task("importmap", () => {
|
415
|
-
return new Utils().importMap()
|
416
|
-
})
|
417
|
-
|
418
|
-
gulp.task("cdn", () => {
|
419
|
-
return Promise.all([new Utils().cdn("templates"), new Utils().cdn("scripts"), new Utils().cdn("styles")])
|
420
|
-
})
|
421
|
-
|
422
|
-
gulp.task("serve", (resolve) => {
|
423
|
-
let tasks = [];
|
424
|
-
|
425
|
-
Config.serve.mode = "dev";
|
426
|
-
Config.errors = false;
|
427
|
-
|
428
|
-
!Config.local && tasks.push("cleanup")
|
429
|
-
Exists.icons && tasks.push("icons")
|
430
|
-
Exists.styles && tasks.push("styles")
|
431
|
-
Exists.scripts && tasks.push("scripts")
|
432
|
-
Exists.templates && tasks.push("templates")
|
433
|
-
|
434
|
-
tasks.push(() => Serve.init(), "watch")
|
435
|
-
|
436
|
-
gulp.series(tasks)(resolve)
|
437
|
-
});
|
438
|
-
|
439
|
-
gulp.task("serve:build", (resolve) => {
|
440
|
-
let tasks = [];
|
441
|
-
|
442
|
-
if (Config.serve.mode === "") {
|
443
|
-
Config.errors = false;
|
444
|
-
Config.serve.mode = "build";
|
445
|
-
}
|
446
|
-
|
447
|
-
!Config.local && tasks.push("cleanup", "cdn")
|
448
|
-
Exists.assets && tasks.push("assets")
|
449
|
-
Exists.icons && tasks.push("icons:build")
|
450
|
-
Exists.styles && tasks.push("styles:build")
|
451
|
-
Exists.scripts && tasks.push("scripts:build")
|
452
|
-
Exists.templates && tasks.push("templates")
|
453
|
-
|
454
|
-
tasks.push(() => Serve.init(), "watch:build")
|
455
|
-
|
456
|
-
gulp.series(tasks)(resolve)
|
457
|
-
})
|
458
|
-
|
459
|
-
gulp.task("serve:production", (resolve) => {
|
460
|
-
let tasks = [];
|
461
|
-
|
462
|
-
if (Config.serve.mode === "") {
|
463
|
-
Config.serve.mode = "production";
|
464
|
-
}
|
465
|
-
|
466
|
-
!Config.local && tasks.push("cleanup", "cdn")
|
467
|
-
Exists.assets && tasks.push("assets:production")
|
468
|
-
Exists.icons && tasks.push("icons:production")
|
469
|
-
Exists.styles && tasks.push("styles:production")
|
470
|
-
Exists.scripts && tasks.push("scripts:production")
|
471
|
-
Exists.templates && tasks.push("templates:production")
|
472
|
-
|
473
|
-
tasks.push(() => Serve.init(), "watch:production")
|
474
|
-
|
475
|
-
gulp.series(tasks)(resolve)
|
476
|
-
})
|
477
|
-
}
|
478
|
-
|
479
|
-
if (Exists.icons) {
|
480
|
-
gulp.task("icons", (resolve) => {
|
481
|
-
if (Config.icons.id !== "") {
|
482
|
-
gulp.series(new Icons().fetch)(resolve)
|
483
|
-
} else {
|
484
|
-
resolve()
|
485
|
-
}
|
486
|
-
})
|
487
|
-
|
488
|
-
gulp.task("icons:build", (resolve) => {
|
489
|
-
Config.icons.optimizations = false;
|
490
|
-
Config.icons.revision = false;
|
491
|
-
|
492
|
-
if (Config.icons.id !== "") {
|
493
|
-
gulp.series(new Icons().fetch, new Icons().build)(resolve)
|
494
|
-
} else {
|
495
|
-
return new Icons().build()
|
496
|
-
}
|
497
|
-
})
|
498
|
-
|
499
|
-
gulp.task("icons:production", () => {
|
500
|
-
return new Icons().build()
|
501
|
-
})
|
502
|
-
}
|
503
|
-
|
504
|
-
if (Exists.scripts) {
|
505
|
-
if (!Config.vite) {
|
506
|
-
gulp.task("scripts", (resolve) => {
|
507
|
-
gulp.series(new Utils().importMap, new Scripts().importResolution)(resolve)
|
508
|
-
})
|
509
|
-
|
510
|
-
gulp.task("scripts:build", (resolve) => {
|
511
|
-
Config.scripts.revision = false;
|
512
|
-
Config.scripts.optimizations = false;
|
513
|
-
Config.scripts.legacy = false;
|
514
|
-
|
515
|
-
gulp.series(new Utils().importMap, new Scripts().importResolution, new Scripts().build)(resolve)
|
516
|
-
})
|
517
|
-
|
518
|
-
gulp.task("scripts:production", (resolve) => {
|
519
|
-
gulp.series(new Utils().importMap, new Scripts().importResolution, new Scripts().build)(resolve)
|
520
|
-
})
|
521
|
-
} else {
|
522
|
-
gulp.task("scripts", (resolve) => {
|
523
|
-
gulp.series(new Scripts().importResolution)(resolve)
|
524
|
-
})
|
525
|
-
}
|
526
|
-
}
|
527
|
-
|
528
|
-
if (Exists.styles) {
|
529
|
-
gulp.task("styles", (resolve) => {
|
530
|
-
gulp.series(new Styles().importResolution)(resolve)
|
531
|
-
})
|
532
|
-
|
533
|
-
if (!Config.vite) {
|
534
|
-
gulp.task("styles:build", (resolve) => {
|
535
|
-
Config.styles.revision = false;
|
536
|
-
Config.styles.purge.enabled = false;
|
537
|
-
Config.styles.optimizations = false;
|
538
|
-
Config.styles.vendor.cache = true;
|
539
|
-
Config.styles.import = ['local'];
|
540
|
-
|
541
|
-
gulp.series(new Styles().importResolution, new Styles().tailwind, new Styles().build)(resolve)
|
542
|
-
})
|
543
|
-
|
544
|
-
gulp.task("styles:production", (resolve) => {
|
545
|
-
gulp.series(new Styles().importResolution, new Styles().tailwind, new Styles().build)(resolve)
|
546
|
-
})
|
547
|
-
}
|
548
|
-
}
|
549
|
-
|
550
|
-
if (Exists.templates) {
|
551
|
-
gulp.task("templates", () => {
|
552
|
-
return new Templates().build("development").then(Functions.serverReload);
|
553
|
-
})
|
554
|
-
|
555
|
-
gulp.task("templates:production", () => {
|
556
|
-
return new Templates().build("production").then(Functions.serverReload);
|
557
|
-
})
|
558
|
-
}
|
559
|
-
|
560
|
-
if (Exists.assets) {
|
561
|
-
gulp.task("assets", async () => {
|
562
|
-
return gulp.src(`${root + Config.paths.input.assets}/**`)
|
563
|
-
.pipe(gulp.dest(root + Config.paths.output.assets))
|
564
|
-
})
|
565
|
-
|
566
|
-
gulp.task("assets:production", () => {
|
567
|
-
return new Promise(async (resolve) => {
|
568
|
-
const revision = (await import("gulp-rev")).default;
|
569
|
-
|
570
|
-
gulp.src(`${root + Config.paths.input.assets}/**`)
|
571
|
-
.pipe(gulpif(Config.assets.revision, revision()))
|
572
|
-
.pipe(Functions.revUpdate(true, "assets"))
|
573
|
-
.pipe(gulp.dest(root + Config.paths.output.assets))
|
574
|
-
.pipe(revision.manifest())
|
575
|
-
.pipe(gulp.dest(root + Config.paths.output.assets))
|
576
|
-
.on("end", resolve)
|
577
|
-
})
|
578
|
-
})
|
579
|
-
}
|
580
|
-
|
581
|
-
if (Exists.emails) {
|
582
|
-
gulp.task("emails", () => {
|
583
|
-
return new Emails().build()
|
584
|
-
})
|
585
|
-
|
586
|
-
gulp.task("emails:zip", () => {
|
587
|
-
return new Emails().zip()
|
588
|
-
})
|
589
|
-
}
|
590
|
-
|
591
|
-
gulp.task("watch", () => {
|
592
|
-
new Watch().dev();
|
593
|
-
})
|
594
|
-
|
595
|
-
if (!Config.vite) {
|
596
|
-
gulp.task("watch:build", () => {
|
597
|
-
new Watch().build("build");
|
598
|
-
})
|
599
|
-
|
600
|
-
gulp.task("watch:production", () => {
|
601
|
-
new Watch().build("production");
|
602
|
-
})
|
603
|
-
}
|
604
|
-
|
605
|
-
if (typeof Package.scripts !== "undefined") {
|
606
|
-
Object.keys(Package.scripts).forEach((script) => {
|
607
|
-
gulp.task(script, (resolve) => {
|
608
|
-
Functions.execSync(Package.scripts[script]);
|
609
|
-
resolve()
|
610
|
-
})
|
611
|
-
})
|
612
|
-
}
|
613
|
-
|
614
|
-
if (!Config.vite && typeof Config.modules.cms !== "undefined") {
|
615
|
-
gulp.task("cms:install", () => {
|
616
|
-
return new Config.modules.cms().install()
|
617
|
-
})
|
618
|
-
|
619
|
-
gulp.task("cms:prepare", (done) => {
|
620
|
-
return new Config.modules.cms().prepare(done)
|
621
|
-
})
|
622
|
-
}
|
623
|
-
}
|
624
|
-
}
|
625
|
-
|
626
|
-
export {Core, Utils, Templates, Styles, Scripts, Icons, Watch, Emails, Exists, Modules, Functions, Package, Config, root}
|