forked from 10quality/swipebox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (46 loc) · 1.35 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var minify = require('gulp-minify');
var jsmin = require('gulp-jsmin');
var cleanCSS = require('gulp-clean-css');
var rename = require("gulp-rename");
var clean = require('gulp-clean');
// Clean build
gulp.task('clean-css', function () {
return gulp.src('./dist/css', {force: true})
.pipe(clean());
});
gulp.task('clean-js', function () {
return gulp.src('./dist/js', {force: true})
.pipe(clean());
});
// Prepare
gulp.task('sass', ['clean-css'], function () {
return gulp.src('./src/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('script', ['clean-js'], function() {
return gulp.src('./src/js/**/*.js')
.pipe(concat('jquery.swipebox.js'))
.pipe(gulp.dest('./dist/js'));
});
// minify
gulp.task('cssmin', ['sass'], function() {
return gulp.src('./dist/css/**/*.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/css/'));
});
gulp.task('jsmin', ['script'], function() {
return gulp.src('./dist/js/**/*.js')
.pipe(jsmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/js'));
});
/// DEFAULT
gulp.task('default', [
'cssmin',
'jsmin',
]);