-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (50 loc) · 1.73 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
var gulp = require("gulp");
var sourcemaps = require("gulp-sourcemaps");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var less = require("gulp-less");
var minify = require("gulp-clean-css");
var babel = require('gulp-babel');
var babelOptions = {
"plugins": [
["transform-es2015-classes", {"loose": true}]
]
};
gulp.task('default', ['concat']);
gulp.task('build', ['concat', 'minify']);
gulp.task('concat', ['concat.js', 'concat.css']);
gulp.task('concat.js', function () {
return gulp.src('./resources/jssrc/**/*.js')
.pipe(sourcemaps.init())
.pipe(babel(babelOptions))
.pipe(concat('psfio.js', {newLine: '\r\n\r\n'}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./resources/js/'));
});
gulp.task('concat.css', function () {
return gulp.src('./resources/less/**/*.less')
.pipe(sourcemaps.init())
.pipe(less())
.pipe(concat('psfio.css', {newLine: '\r\n\r\n'}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./resources/css/'));
});
gulp.task('minify', ['minify.js', 'minify.css']);
gulp.task('minify.js', function() {
return gulp.src('./resources/jssrc/**/*.js')
.pipe(sourcemaps.init())
.pipe(babel(babelOptions))
.pipe(concat('psfio.min.js', {newLine: '\r\n\r\n'}))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./resources/js/'));
});
gulp.task('minify.css', function() {
return gulp.src('./resources/less/**/*.less')
.pipe(sourcemaps.init())
.pipe(less())
.pipe(concat('psfio.min.css', {newLine: '\r\n\r\n'}))
.pipe(minify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./resources/css/'));
});