-
Notifications
You must be signed in to change notification settings - Fork 10
/
gulpfile.js
110 lines (101 loc) · 4.24 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
100
101
102
103
104
105
106
107
108
109
110
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var rename = require('gulp-rename');
var csscomb = require('gulp-csscomb');
var filesize = require('gulp-filesize');
var uglify = require('gulp-uglify');
var paths = {
sass: ['./grails-app/assets/stylesheets/beerstrap/**/*.scss'],
js: ['./grails-app/assets/javascripts/**/*.js']
};
var vendor = {
css: [
'./grails-app/assets/vendor/fontawesome/css/font-awesome.min.css',
'./grails-app/assets/vendor/bootstrap-datepicker/css/datepicker3.css',
'./grails-app/assets/vendor/select2/select2.css',
'./grails-app/assets/vendor/select2/select2-bootstrap.css',
'./grails-app/assets/vendor/jquery-file-upload/css/jquery.fileupload-ui.css',
'./grails-app/assets/vendor/toastr/toastr.min.css',
'./grails-app/assets/vendor/c3/c3.css',
'./grails-app/assets/vendor/leaflet/dist/leaflet.css',
'./grails-app/assets/vendor/leaflet-fullscreen/dist/leaflet.fullscreen.css'
],
js: [
'./grails-app/assets/vendor/jquery/dist/jquery.min.js',
'./grails-app/assets/vendor/jquery-cookie/jquery.cookie.js',
'./grails-app/assets/vendor/bootstrap/dist/js/bootstrap.min.js',
'./grails-app/assets/vendor/typeahead.js/dist/typeahead.bundle.min.js',
'./grails-app/assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js',
'./grails-app/assets/vendor/select2/select2.min.js',
'./grails-app/assets/vendor/d3/d3.min.js',
'./grails-app/assets/vendor/c3/c3.min.js',
'./grails-app/assets/vendor/peity/jquery.peity.min.js',
'./grails-app/assets/vendor/jquery-knob/js/jquery.knob.js',
'./grails-app/assets/vendor/jquery-file-upload/js/vendor/jquery.ui.widget.js',
'./grails-app/assets/vendor/jquery-file-upload/js/jquery.iframe-transport.js',
'./grails-app/assets/vendor/jquery-file-upload/js/jquery.fileupload.js',
'./grails-app/assets/vendor/holderjs/holder.js',
'./grails-app/assets/vendor/toastr/toastr.min.js',
'./grails-app/assets/vendor/tinymce/tinymce.min.js',
'./grails-app/assets/vendor/leaflet/dist/leaflet.js',
'./grails-app/assets/vendor/leaflet-fullscreen/dist/Leaflet.fullscreen.js',
'./grails-app/assets/vendor/beerstrap/reports/c3-mock.js',
'./grails-app/assets/vendor/beerstrap/maps/leaflet-mock.js',
'./grails-app/assets/vendor/beerstrap/beerstrap-init.js',
'./grails-app/assets/vendor/beerstrap/beerstrap-utils.js',
'./grails-app/assets/vendor/beerstrap/beerstrap-ajax.js'
]
};
gulp.task('default', ['jshint']);
gulp.task('jshint', function () {
return gulp.src(paths.js)
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('vendorcss', function() {
return gulp.src(vendor.css)
.pipe(concat('vendor.css'))
.pipe(csscomb())
.pipe(gulp.dest('./grails-app/assets/stylesheets/'))
.pipe(filesize())
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename('vendor.min.css'))
.pipe(gulp.dest('./grails-app/assets/stylesheets/'))
.pipe(filesize())
.on('error', gutil.log)
});
gulp.task('vendorjs', function() {
return gulp.src(vendor.js)
.pipe(concat('vendor.js'))
.pipe(gulp.dest('./grails-app/assets/javascripts/'))
.pipe(filesize())
//.pipe(uglify())
.pipe(rename('vendor.min.js'))
.pipe(gulp.dest('./grails-app/assets/javascripts/'))
.pipe(filesize())
.on('error', gutil.log)
});
gulp.task('sass', function (done) {
gulp.src(paths.sass)
.pipe(sass().on('error', gutil.log))
.pipe(csscomb())
.pipe(gulp.dest('./grails-app/assets/stylesheets/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({extname: '.min.css'}))
.pipe(gulp.dest('./grails-app/assets/stylesheets/'))
.on('end', done);
});
gulp.task('watch', function () {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.js, ['jshint']);
});