-
Notifications
You must be signed in to change notification settings - Fork 16
/
gulpfile.js
58 lines (51 loc) · 1.3 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const css = require('gulp-cssimport');
const tildeImporter = require('node-sass-tilde-importer');
const themes = [
'default',
'graphql',
'react',
'webpack',
'minecraft',
'cerulean',
'litera',
'material'
];
const tasks = [];
const watch = ['src/components/**/*.scss', 'src/themes/**/*.scss'];
themes.forEach(item => {
gulp.task(`compile-theme-${item}`, () =>
gulp
.src(`src/themes/${item}/index.scss`)
.pipe(
sass({
includePaths: ['node_modules'],
importer: tildeImporter
})
) // Using gulp-sass
.pipe(css())
.pipe(gulp.dest(`assets/themes/${item}`))
.pipe(gulp.dest(`src/themes/${item}`))
);
tasks.push(`compile-theme-${item}`);
});
gulp.task(`compile-components`, () =>
gulp
.src(`src/components/**/style.scss`)
.pipe(
sass({
includePaths: ['node_modules'],
importer: tildeImporter
})
)
.pipe(css())
.pipe(gulp.dest(`src/components`))
);
gulp.task('compile-themes-watch', () => {
gulp.watch(watch, gulp.parallel(tasks));
});
gulp.task('compile-components-watch', () => {
gulp.watch(['src/components/**/*.scss'], gulp.parallel(['compile-components']));
});
gulp.task('compile-themes-force', gulp.series(tasks));