forked from jupiter-project/metis-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (47 loc) · 1.31 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const cleanCSS = require('gulp-clean-css');
const rename = require('gulp-rename');
const autoprefixer = require('gulp-autoprefixer');
// Copy third party libraries from /node_modules into /vendor
// gulp.task('vendor', () => {
// // Bootstrap
// gulp.src([
// './node_modules/bootstrap/dist/**/*',
// '!./node_modules/bootstrap/dist/css/bootstrap-grid*',
// '!./node_modules/bootstrap/dist/css/bootstrap-reboot*'
// ])
// .pipe(gulp.dest('./public/vendor/bootstrap'))
// });
// Compile SCSS
gulp.task('css:compile', () => {
gulp.src('./public/scss/**/*.scss')
.pipe(sass.sync({
outputStyle: 'expanded',
}).on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false,
}))
.pipe(gulp.dest('./public/css'));
});
// Minify CSS
gulp.task('css:minify', ['css:compile'], () => {
gulp.src([
'./public/css/*.css',
'!./public/css/*.min.css',
])
.pipe(cleanCSS())
.pipe(rename({
suffix: '.min',
}))
.pipe(gulp.dest('./public/css'));
});
// CSS
gulp.task('css', ['css:compile', 'css:minify']);
// Default task
gulp.task('default', ['css']);
// Dev task
gulp.task('dev', ['css'], () => {
gulp.watch('./public/scss/*.scss', ['css']);
});