-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
99 lines (88 loc) · 3.18 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
var gulp = require('gulp'),
sass = require('gulp-sass'),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
sourcemaps = require('gulp-sourcemaps'),
merge = require('merge-stream'),
uglify = require('gulp-uglify'),
uglifycss = require('gulp-uglifycss'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
rename = require('gulp-rename');
var vendor_js = [
'./resources/assets/js/vendors/jquery.min.js',
'./resources/assets/js/vendors/bootstrap.min.js',
'./resources/assets/js/vendors/jquery.mCustomScrollbar.concat.min.js',
'./resources/assets/js/vendors/bootstrap-datetimepicker.js',
'./resources/assets/js/vendors/select2.min.js',
'./resources/assets/js/vendors/jquery.bootstrap-growl.min.js',
'./resources/assets/js/vendors/jquery-ui-1.10.4.custom.min.js',
'./resources/assets/js/vendors/jquery.validate.min.js',
'./resources/assets/js/vendors/mustache.min.js'
];
var vendor_css = [
'./resources/assets/css/vendors/bootstrap.min.css',
'./resources/assets/css/vendors/jquery.mCustomScrollbar.css',
'./resources/assets/css/vendors/bootstrap-datetimepicker.min.css',
'./resources/assets/css/vendors/select2.min.css',
//'./resources/assets/css/vendors/font-awesome.min.css'
];
var custom_js = [
'./resources/assets/js/custom/app.js',
'./resources/assets/js/custom/sort.js'
];
gulp.task('compress-vendorJs', function () {
return gulp.src(vendor_js)
.pipe(concat('vendors.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./public/js'))
.pipe(notify({message: 'Vendor javascript files successfully compressed.'}));
});
gulp.task('compress-vendorCSS', function () {
return gulp.src(vendor_css)
.pipe(concat('vendors.css'))
.pipe(rename({suffix: '.min'}))
.pipe(uglifycss())
.pipe(gulp.dest('./public/css'))
.pipe(notify({message: 'Vendor css files successfully compressed.'}));
});
/**
* Compile files from backend scss
*/
gulp.task('sass', function () {
var backend = gulp.src('./resources/assets/scss/custom/app.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(postcss([autoprefixer({browsers: ['last 30 versions', '> 1%', 'ie 8', 'ie 7']})]))
.pipe(sourcemaps.write('./maps'))
.pipe(uglifycss({
"max-line-len": 80
}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./public/css/'));
});
gulp.task('js', function () {
return gulp.src(custom_js)
.pipe(concat('app.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./public/js'))
.pipe(notify({message: 'Custom javascript successfully compressed.'}));
});
/*
* Watch scss files for changes & recompile
*/
gulp.task('watch-sass', function () {
gulp.watch('./resources/assets/scss/**/*.scss', ['sass']);
});
/*
* Watch javascript files for changes & recompile
*/
gulp.task('watch-js', function () {
gulp.watch('./resources/assets/js/**/*.js', ['js']);
});
/*
* Default task, running just `gulp` will compile the sass,
*/
gulp.task('default', ['sass', 'js', 'watch-sass', 'watch-js']);