-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.js
65 lines (58 loc) · 1.83 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import {
buildCSS,
buildJS,
generateManifest,
runTests,
watchJS,
} from '@hypothesis/frontend-build';
import gulp from 'gulp';
import tailwindConfig from './tailwind.config.js';
gulp.task('build-js', () => buildJS('./rollup.config.js'));
gulp.task('watch-js', () => watchJS('./rollup.config.js'));
gulp.task('build-css', () =>
buildCSS(
[
'./lms/static/styles/canvas_pages/canvas_pages.scss',
'./lms/static/styles/moodle_pages/moodle_pages.scss',
'./lms/static/styles/frontend_apps.scss',
'./lms/static/styles/lms.scss',
'./lms/static/styles/ui-playground.scss',
],
{ tailwindConfig },
),
);
gulp.task('watch-css', () => {
gulp.watch(
[
'./lms/static/styles/**/*.{css,scss}',
'./lms/static/scripts/frontend_apps/**/*.js',
'./lms/static/scripts/frontend_apps/**/*.ts',
'./lms/static/scripts/frontend_apps/**/*.tsx',
'./lms/static/scripts/ui-playground/**/*.js',
'./lms/static/scripts/ui-playground/**/*.ts',
'./lms/static/scripts/ui-playground/**/*.tsx',
],
{ ignoreInitial: false },
gulp.series('build-css'),
);
});
gulp.task('watch-manifest', () => {
gulp.watch('build/**/*.{css,js,map}', generateManifest);
});
gulp.task('build', gulp.series(['build-js', 'build-css'], generateManifest));
gulp.task('watch', gulp.parallel(['watch-js', 'watch-css', 'watch-manifest']));
// Unit and integration testing tasks.
//
// Some (eg. a11y) tests rely on CSS bundles. We assume that JS will always take
// longer to build than CSS, so build in parallel.
gulp.task(
'test',
gulp.parallel('build-css', () =>
runTests({
bootstrapFile: 'lms/static/scripts/bootstrap.js',
karmaConfig: 'lms/static/scripts/karma.config.cjs',
rollupConfig: 'rollup-tests.config.js',
testsPattern: 'lms/static/scripts/**/*-test.js',
}),
),
);