-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
53 lines (47 loc) · 1.68 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
const gulp = require('gulp');
const { series } = require('gulp');
const bower = require('gulp-bower');
const concat = require('gulp-concat');
const sass = require('gulp-sass')(require('sass'));
const del = require('del');
const merge = require('merge-stream');
const minifyCSS = require('gulp-minify-css');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
const config = {
bowerDir: './bower_components',
};
gulp.task('bootstrap', function() {
const style = gulp.src(config.bowerDir + '/bootstrap/scss/bootstrap.scss')
.pipe(concat('bootstrap.scss'))
.pipe(gulp.dest('./tmp'));
// const fonts = gulp.src(config.bowerDir + '/bootstrap/dist/fonts/**/*')
// .pipe(gulp.dest('./dist/fonts'));
const scripts = gulp.src(config.bowerDir + '/bootstrap/dist/js/**/*')
.pipe(sourcemaps.write())
.pipe(gulp.dest('./dist/js'));
return merge(style, scripts);
});
gulp.task('bower', function() {
return bower(config.bowerDir);
});
gulp.task('clean', () => {
return del(['dist/css', 'dist/js', 'tmp']);
});
gulp.task('cssmin', () => {
return gulp.src('dist/css/**/*.css')
.pipe(minifyCSS())
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('dist/css'))
})
gulp.task('styles', () => {
return gulp.src('./sass/theme.scss')
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: ['sass', 'tmp', config.bowerDir + '/bootstrap/scss/'],
}).on('error', sass.logError))
.pipe(concat('bootstrap.css'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('default', series('clean', 'bower', 'bootstrap', 'styles', 'cssmin'));