This repository has been archived by the owner on Dec 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (63 loc) · 2.3 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
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var minify = require('gulp-minifier');
var concat = require('gulp-concat');
var minifyCSS = require('gulp-minify-css');
var mainBowerFiles = require('gulp-main-bower-files');
var uglify = require('gulp-uglify');
var flatten = require('gulp-flatten');
var watch = require('gulp-watch');
//--------------------------------------------------
gulp.task('default', ['watch']);
//--------------------------------------------------
gulp.task('watch', function () {
gulp.watch('assets/**/*.*', ['backendjs', 'backendcss']);
});
//--------------------------------------------------
gulp.task('build', ['backendjs', 'backendcss', 'bowerjs', 'bowercss', 'fonts', 'vendor']);
//--------------------------------------------------
gulp.task('backendjs', function() {
gulp.src('assets/backend/pages/**/*.js')
.pipe(minify({
//minify: true,
collapseWhitespace: true,
conservativeCollapse: true,
//minifyJS: true
}))
.pipe(gulp.dest('./public/assets/backend/pages'))
});
//--------------------------------------------------
gulp.task('backendcss', function() {
gulp.src('assets/backend/pages/**/*.css')
.pipe(minifyCSS())
.pipe(gulp.dest('./public/assets/backend/pages'))
});
//--------------------------------------------------
gulp.task('bowerjs', function(){
return gulp.src('./bower.json')
.pipe(mainBowerFiles('**/*.js'))
.pipe(uglify())
.pipe(concat('bower.js'))
.pipe(gulp.dest('./public/assets/bower'));
});
//--------------------------------------------------
gulp.task('bowercss', function(){
return gulp.src('./bower.json')
.pipe(mainBowerFiles('**/*.css'))
.pipe(minifyCSS())
.pipe(concat('bower.css'))
.pipe(gulp.dest('./public/assets/bower'));
});
//--------------------------------------------------
gulp.task('fonts', function() {
return gulp.src('./bower_components/**/fonts/*')
.pipe(flatten())
.pipe(gulp.dest('./public/assets/fonts/'));
});
//--------------------------------------------------
// Basic usage
gulp.task('vendor', function() {
gulp.src('assets/vendor/**/*')
.pipe(gulp.dest('./public/assets/vendor'))
});
//--------------------------------------------------