-
Notifications
You must be signed in to change notification settings - Fork 1
/
fusionfile.mjs
133 lines (117 loc) · 2.95 KB
/
fusionfile.mjs
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
* Part of Windwalker Fusion project.
*
* @copyright Copyright (C) 2021 LYRASOFT.
* @license MIT
*/
import fusion, { sass, babel, parallel } from '@windwalker-io/fusion';
import { jsSync, installVendors, findModules } from '@windwalker-io/core';
export async function css() {
// Watch start
fusion.watch([
'resources/assets/scss/**/*.scss',
'src/Module/**/assets/*.scss',
...findModules('**/assets/*.scss')
]);
// Watch end
// Front
sass(
[
'resources/assets/scss/front/main.scss',
...findModules('Front/**/assets/*.scss'),
'src/Module/Front/**/assets/*.scss'
],
'www/assets/css/front/main.css'
);
sass(
'resources/assets/scss/front/bootstrap.scss',
'www/assets/css/front/bootstrap.css'
);
// Admin
sass(
[
'resources/assets/scss/admin/main.scss',
...findModules('Admin/**/assets/*.scss'),
'src/Module/Admin/**/assets/*.scss'
],
'www/assets/css/admin/main.css'
);
}
export async function js() {
// Watch start
fusion.watch(['resources/assets/src/**/*.{js,mjs}']);
// Watch end
// Compile Start
babel('resources/assets/src/**/*.{js,mjs}', 'www/assets/js/', { module: 'systemjs' });
// Compile end
return syncJS();
}
export async function images() {
// Watch start
fusion.watch('resources/assets/images/**/*');
// Watch end
// Compile Start
return await fusion.copy('resources/assets/images/**/*', 'www/assets/images/')
// Compile end
}
export async function syncJS() {
// Watch start
fusion.watch(['src/Module/**/assets/**/*.{js,mjs}', ...findModules('**/assets/*.{js,mjs}')]);
// Watch end
// Compile Start
const { dest } = await jsSync(
'src/Module/',
'www/assets/js/view/'
);
babel(dest.path + '**/*.{mjs,js}', null, { module: 'systemjs' });
// Compile end
return Promise.all([]);
}
export async function install() {
return installVendors(
[
'@fortawesome/fontawesome-free',
'wowjs',
'animate.css',
'jarallax',
],
[
'lyrasoft/luna'
]
);
}
export default parallel(css, js, images);
/*
* APIs
*
* Compile entry:
* fusion.js(source, dest, options = {})
* fusion.babel(source, dest, options = {})
* fusion.module(source, dest, options = {})
* fusion.ts(source, dest, options = {})
* fusion.typeScript(source, dest, options = {})
* fusion.css(source, dest, options = {})
* fusion.sass(source, dest, options = {})
* fusion.copy(source, dest, options = {})
*
* Live Reload:
* fusion.livereload(source, dest, options = {})
* fusion.reload(file)
*
* Gulp proxy:
* fusion.src(source, options)
* fusion.dest(path, options)
* fusion.watch(glob, opt, fn)
* fusion.symlink(directory, options = {})
* fusion.lastRun(task, precision)
* fusion.tree(options = {})
* fusion.series(...tasks)
* fusion.parallel(...tasks)
*
* Stream Helper:
* fusion.through(handler) // Same as through2.obj()
*
* Config:
* fusion.disableNotification()
* fusion.enableNotification()
*/