This repository has been archived by the owner on Feb 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
95 lines (80 loc) · 3.03 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
// ####################### CONFIGURATION #######################
var themeR = 'app/www/';
var path = {
css: themeR + "css/",
js: themeR + "js/",
img: themeR + "img/"
};
// ####################### REQUIRES #######################
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
notify = require('gulp-notify'),
uglify = require('gulp-uglify');
// ####################### TASKS #######################
gulp.task('styles', function () {
return gulp.src(path.css + 'src/**/*.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(path.css));
//.pipe(notify({ message: 'Styles task complete', onLast: true }));
});
gulp.task('vendorsJS', function () {
return gulp.src(path.js + 'lib/**/*.js')
.pipe(concat('lib.min.js'))
.pipe(uglify())
.pipe(gulp.dest(path.js));
//.pipe(notify({ message: 'Vendor scripts task complete', onLast: true }));
});
gulp.task('framework7', function () {
return gulp.src(path.js + 'framework7/**/*.js')
.pipe(concat('framework7.min.js'))
.pipe(uglify())
.pipe(gulp.dest(path.js));
});
gulp.task('serviceJs', function () {
return gulp.src(path.js + 'service/**/*.js')
.pipe(concat('service.min.js'))
.pipe(uglify())
.pipe(gulp.dest(path.js));
//.pipe(notify({ message: 'Custom scripts task complete', onLast: true }));
});
gulp.task('apiJs', function () {
return gulp.src(path.js + 'api/**/*.js')
.pipe(concat('api.min.js'))
.pipe(uglify())
.pipe(gulp.dest(path.js));
//.pipe(notify({ message: 'Custom scripts task complete', onLast: true }));
});
gulp.task('pageJs', function () {
return gulp.src(path.js + 'page/**/*.js')
.pipe(concat('page.min.js'))
.pipe(uglify())
.pipe(gulp.dest(path.js));
//.pipe(notify({ message: 'Custom scripts task complete', onLast: true }));
});
gulp.task('scriptsJs', function () {
return gulp.src(path.js + 'src/**/*.js')
.pipe(concat('master.min.js'))
.pipe(uglify())
.pipe(gulp.dest(path.js));
//.pipe(notify({ message: 'Custom scripts task complete', onLast: true }));
});
gulp.task('img', function () {
return gulp.src(path.img+'src/**/*.{png,jpg,jpeg,gif,svg}')
.pipe(imagemin({ optimizationLevel: 7, progressive: true, interlaced: true }))
.pipe(gulp.dest(path.img));
//.pipe( notify( { message: 'Images task complete', onLast: true } ) );
});
gulp.task('watch', function () {
gulp.watch(path.css + '**/*.scss', ['styles']);
gulp.watch(path.js + '**/*.js', ['scriptsJs']);
});
gulp.task('default', ['styles','vendorsJS','framework7','serviceJs','apiJs','pageJs','scriptsJs','img']);