forked from andresgalante/patternfly-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (61 loc) · 2.19 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
const gulp = require('gulp');
const rename = require('gulp-rename');
const replace = require('gulp-string-replace');
const sass = require('gulp-sass');
const sassGlob = require('gulp-sass-glob');
const cssnano = require('gulp-cssnano');
const sourcemaps = require('gulp-sourcemaps');
gulp.task('build', ['build-modules', 'build-library', 'copy-fa', 'copy-source', 'minify-css']);
gulp.task('copy-fa', () =>
gulp
.src('./node_modules/@fortawesome/fontawesome/styles.css')
.pipe(rename('fontawesome.css'))
.pipe(gulp.dest('./dist/assets/icons'))
);
gulp.task('build-tmp', () =>
gulp
.src(['./src/patternfly/**/*.scss', '!./src/patternfly/**/examples/*.scss'])
.pipe(
sassGlob({
ignorePaths: ['**/examples/*.scss']
})
)
.pipe(replace('@import "../../patternfly-utilities";', ''))
.pipe(gulp.dest('./tmp'))
);
gulp.task('build-library', ['build-tmp'], () =>
gulp
.src('./tmp/patternfly*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./dist'))
);
gulp.task('minify-css', ['build-library'], () => {
gulp
.src('./dist/patternfly.css')
.pipe(sourcemaps.init())
.pipe(cssnano())
.pipe(rename('patternfly.min.css'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./dist'));
});
gulp.task('build-modules', () =>
gulp
.src([
'./src/patternfly/{components,layouts,patterns,utilities}/**/*.scss',
'!./src/patternfly/{components,layouts,patterns,utilities}/**/examples/*.scss'
])
.pipe(sass().on('error', sass.logError))
.pipe(replace('./assets/images', '../../assets/images'))
.pipe(gulp.dest('./dist'))
);
gulp.task('copy-source', ['copy-icons', 'build-tmp'], () => {
gulp.src('./README.md').pipe(gulp.dest('./dist'));
gulp.src('./package.json').pipe(gulp.dest('./dist'));
gulp.src('./tmp/**/*.scss').pipe(gulp.dest('./dist'));
gulp.src('./static/assets/images/**/*.*').pipe(gulp.dest('./dist/assets/images/'));
gulp.src('./src/patternfly/assets/**/*.*').pipe(gulp.dest('./dist/assets/'));
});
gulp.task('copy-icons', () => {
gulp.src('./src/icons/definitions/**/*.*').pipe(gulp.dest('./dist/icons/'));
gulp.src('./src/icons/PfIcons/**/*.*').pipe(gulp.dest('./dist/icons/PfIcons/'));
});