-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
92 lines (90 loc) · 2.45 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var cleanCSS = require('gulp-clean-css');
var rename = require("gulp-rename");
var uglify = require('gulp-uglify');
// Copy third party libraries from /node_modules into /vendor
gulp.task('vendor', function() {
// 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'))
// ChartJS
gulp.src([
'node_modules/chart.js/dist/*.js'
])
.pipe(gulp.dest('public/vendor/chart.js'))
// DataTables
gulp.src([
'node_modules/datatables.net/js/*.js',
'node_modules/datatables.net-bs4/js/*.js',
'node_modules/datatables.net-bs4/css/*.css'
])
.pipe(gulp.dest('public/vendor/datatables/'))
// Font Awesome
gulp.src([
'node_modules/font-awesome/**/*',
'!node_modules/font-awesome/{less,less/*}',
'!node_modules/font-awesome/{scss,scss/*}',
'!node_modules/font-awesome/.*',
'!node_modules/font-awesome/*.{txt,json,md}'
])
.pipe(gulp.dest('public/vendor/font-awesome'))
// jQuery
gulp.src([
'node_modules/jquery/dist/*',
'!node_modules/jquery/dist/core.js'
])
.pipe(gulp.dest('public/vendor/jquery'))
// jQuery Easing
gulp.src([
'node_modules/jquery.easing/*.js'
])
.pipe(gulp.dest('public/vendor/jquery-easing'))
});
// Compile SCSS
gulp.task('css:compile', function() {
return gulp.src('public/scss/**/*.scss')
.pipe(sass.sync({
outputStyle: 'expanded'
}).on('error', sass.logError))
.pipe(gulp.dest('public/css'))
});
// Minify CSS
gulp.task('css:minify', ['css:compile'], function() {
return 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']);
// Minify JavaScript
gulp.task('js:minify', function() {
return gulp.src([
'public/js/*.js',
'!public/js/*.min.js'
])
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('public/js'));
});
// JS
gulp.task('js', ['js:minify']);
// Default task
gulp.task('default', ['css', 'js', 'vendor']);
// Dev task
gulp.task('dev', ['css', 'js'], function() {
gulp.watch('public/scss/**/*.scss', ['css']);
gulp.watch('public/js/*.js', ['js']);
});