-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
62 lines (53 loc) · 1.62 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
import { buildCSS, runTests, watchJS } from '@hypothesis/frontend-build';
import gulp from 'gulp';
import { servePatternLibrary } from './scripts/serve-pattern-library.js';
import tailwindConfig from './tailwind.config.js';
gulp.task('serve-pattern-library', () => {
servePatternLibrary();
});
// The following tasks bundle assets for the pattern library for use locally
// during development. Bundled JS and CSS are not published with the package.
gulp.task('bundle-css', () =>
buildCSS(['./styles/pattern-library.scss'], { tailwindConfig }),
);
gulp.task(
'watch-css',
gulp.series('bundle-css', () =>
gulp.watch(
[
'./styles/**/*.scss',
'./src/components/**/*.js',
'./src/components/**/*.ts*',
'./src/pattern-library/**/*.js',
'./src/pattern-library/**/*.ts*',
],
gulp.task('bundle-css'),
),
),
);
gulp.task('watch-js', () => watchJS('./rollup.config.js'));
gulp.task(
'watch',
gulp.parallel('serve-pattern-library', 'watch-css', 'watch-js'),
);
/**
* Task to build a CSS bundle.
*
* nb. This is only used for unit tests that need CSS to verify accessibility requirements.
*/
gulp.task('build-test-css', () =>
buildCSS(['styles/test.scss'], { tailwindConfig }),
);
// 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-test-css', () =>
runTests({
bootstrapFile: 'test/bootstrap.js',
rollupConfig: 'rollup-tests.config.js',
karmaConfig: 'src/karma.config.cjs',
testsPattern: 'src/**/*-test.js',
}),
),
);