forked from react-toolbox/react-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
78 lines (67 loc) · 1.66 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
66
67
68
69
70
71
72
73
74
75
76
77
78
const path = require('path');
const gulp = require('gulp');
const babel = require('gulp-babel');
const postcss = require('gulp-postcss');
const paths = {
js: {
src: [
'./components/**/*.js',
'!./components/**/*.spec.js',
'!./components/**/__test__',
'!./components/__mocks__/**/*.js'
],
},
css: {
src: [
'./components/*.css',
'./components/**/*.css'
],
},
tsd: {
src: './components/**/*.d.ts',
},
dest: './lib',
}
function js(cb) {
gulp.src(paths.js.src)
.pipe(babel())
.pipe(gulp.dest(paths.dest));
cb()
};
function css(cb) {
// Copied from webpack/postcss.config.js
const plugins = [
require('postcss-import')({
root: path.join(__dirname, '../'),
path: path.join(__dirname, '../components')
}),
require('postcss-mixins'),
require('postcss-each'),
require('postcss-apply'),
require('postcss-preset-env')({
stage: 0, // required to get all features that were from cssnext
features: {
'custom-properties': {
preserve: false // required to output values instead of variables
},
'color-mod-function': true, // required to use color-mod()
}
}),
require('postcss-calc'), // required as postcss-preset-env doesn't have a reduce calc() funtion
require('postcss-normalize'),
require('postcss-reporter')({
clearReportedMessages: true
})
]
gulp.src(paths.css.src)
.pipe(postcss(plugins))
.pipe(gulp.dest(paths.dest));
cb()
};
function tsd(cb) {
gulp.src(paths.tsd.src)
.pipe(gulp.dest(paths.dest));
cb()
};
const build = gulp.series(js, css, tsd)
gulp.task('default', build)