This repository was archived by the owner on Feb 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
97 lines (84 loc) · 2.71 KB
/
gulpfile.js
File metadata and controls
97 lines (84 loc) · 2.71 KB
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
'use strict';
var gulp = require('gulp');
var os = require('os');
var rimraf = require('gulp-rimraf');
var path = require('path');
var $ = require('gulp-load-plugins')();
var notify = require('gulp-notify');
// var app = 'src/';
var dist = 'dist/';
var autoprefixerBrowsers = [
'ie >= 11',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 6',
'opera >= 23',
'ios >= 6',
'android >= 4.4',
'bb >= 10'
];
// tasks definition
gulp.task('clean', function () {
return gulp.src([
__dirname + '/api/static/css/*',
__dirname + '/api/static/images/*',
__dirname + '/build/static/css/*',
__dirname + '/build/api-php/*',
__dirname + '/build/.htaccess',
]).pipe(rimraf());
});
gulp.task('styles', function () {
return gulp.src(__dirname + '/src/sdk/**/*.scss')
.pipe($.plumber())
.pipe($.sass({errLogToConsole: true, compress: true, 'include css': true}))
.pipe($.autoprefixer(autoprefixerBrowsers))
.pipe($.flatten())
.pipe($.csso())
.pipe(gulp.dest(__dirname + '/api/static/css'))
.pipe(gulp.dest(__dirname + '/build/static/css'))
.pipe($.size({title: 'css'}))
.pipe($.notify({
message: 'SCSS compilation complete.',
notifier: function () {
return false;
}
}));
});
gulp.task('images', function () {
return gulp.src([
__dirname + '/src/assets/images/**/*.{png,jpg,jpeg,gif,svg}',
__dirname + '/src/assets/images/*.{png,jpg,jpeg,gif,svg}'
])
.pipe($.plumber())
.pipe($.rename(function (path) {
var temp = path.dirname.split("/");
temp.splice(0, 4);
path.dirname = temp.toString().replace(/,/g, "/");
}))
.pipe(gulp.dest(__dirname + '/api/static/images'))
.pipe(gulp.dest(__dirname + '/build/static/images'))
.pipe($.size());
});
gulp.task('php-handling', function () {
return gulp.src([
__dirname + '/.htaccess'
]).pipe(gulp.dest(__dirname + '/build'))
});
gulp.task('php-api', function () {
return gulp.src([
__dirname + '/api-php/api.php',
__dirname + '/.htaccess'
]).pipe(gulp.dest(__dirname + '/build/api-php'))
});
// watch styl, html and js file changes
/*gulp.task('watch', function () {
gulp.watch(app + 'assets/scss/!*.scss', ['styles']);
gulp.watch(app + 'assets/scss/!**!/!*.scss', ['styles']);
});*/
// waits until clean is finished then builds the project
gulp.task('build', ['clean'], function () {
return gulp.start(['images', 'styles', 'php-api', 'php-handling']);
});
gulp.task('default', ['build'], function () {
});