-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (55 loc) · 1.92 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
/*
|--------------------------------------------------------------------------
| CSS and Javascript file minify by gulp
|--------------------------------------------------------------------------
*/
var fs = require('fs');
var path = require('path');
var merge = require('merge-stream');
// Include gulp
var gulp = require('gulp');
var runSequence = require('run-sequence');
var clean = require('gulp-clean');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var minifycss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
gulp.task('clean-mainScripts', function () {
return gulp.src('src/public/js/*.js', {read: false})
.pipe(clean());
});
gulp.task('clean-sass', function () {
return gulp.src('src/public/css/*.css', {read: false})
.pipe(clean());
});
// Compile Our Sass
gulp.task('sass', ['clean-sass'], function() {
return gulp.src('resources/assets/sass/app.scss')
.pipe(sass())
.pipe(gulp.dest('src/public/css'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('src/public/css'));
});
// Concatenate & Minify JS
gulp.task('mainScripts', ['clean-mainScripts'], function() {
return gulp.src([
'bower_packages/jQuery/dist/jquery.min.js',
'bower_packages/bootstrap/dist/js/bootstrap.min.js',
'bower_packages/remodal/dist/remodal.min.js',
'bower_packages/bootstrap-growl/jquery.bootstrap-growl.min.js',
'bower_packages/cropper/dist/cropper.min.js',
'resources/assets/js/cropmain-public.js',
'resources/assets/js/main.js'
])
.pipe(concat('all.js'))
.pipe(gulp.dest('src/public/js'))
.pipe(rename('all.min.js'))
.pipe(uglify())
.pipe(gulp.dest('src/public/js'));
});
// Final Build
gulp.task('default', function(callback) {
runSequence('mainScripts','sass',callback);
});