-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
141 lines (111 loc) · 8.38 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
'use strict';
// sass compile
var gulp = require('gulp');
//var sass = require('gulp-sass');
var prettify = require('gulp-prettify');
var minifyCss = require("gulp-minify-css");
var rename = require("gulp-rename");
var uglify = require("gulp-uglify");
var rtlcss = require("gulp-rtlcss");
var connect = require('gulp-connect');
//*** Localhost server tast
gulp.task('localhost', function() {
connect.server();
});
gulp.task('localhost-live', function() {
connect.server({
livereload: true
});
});
//*** SASS compiler task
gulp.task('sass', function () {
// bootstrap compilation
gulp.src('./sass/bootstrap.scss').pipe(sass()).pipe(gulp.dest('./assets/global/plugins/bootstrap/css/'));
// select2 compilation using bootstrap variables
gulp.src('./assets/global/plugins/select2/sass/select2-bootstrap.min.scss').pipe(sass({outputStyle: 'compressed'})).pipe(gulp.dest('./assets/global/plugins/select2/css/'));
// global theme stylesheet compilation
gulp.src('./sass/global/*.scss').pipe(sass()).pipe(gulp.dest('./assets/global/css'));
gulp.src('./sass/apps/*.scss').pipe(sass()).pipe(gulp.dest('./assets/apps/css'));
gulp.src('./sass/pages/*.scss').pipe(sass()).pipe(gulp.dest('./assets/pages/css'));
// theme layouts compilation
gulp.src('./sass/layouts/layout/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout/css'));
gulp.src('./sass/layouts/layout/themes/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout/css/themes'));
gulp.src('./sass/layouts/layout2/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout2/css'));
gulp.src('./sass/layouts/layout2/themes/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout2/css/themes'));
gulp.src('./sass/layouts/layout3/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout3/css'));
gulp.src('./sass/layouts/layout3/themes/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout3/css/themes'));
gulp.src('./sass/layouts/layout4/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout4/css'));
gulp.src('./sass/layouts/layout4/themes/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout4/css/themes'));
gulp.src('./sass/layouts/layout5/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout5/css'));
gulp.src('./sass/layouts/layout6/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout6/css'));
gulp.src('./sass/layouts/layout7/*.scss').pipe(sass()).pipe(gulp.dest('./assets/layouts/layout7/css'));
});
//*** SASS watch(realtime) compiler task
gulp.task('sass:watch', function () {
gulp.watch('./sass/**/*.scss', ['sass']);
});
//*** CSS & JS minify task
gulp.task('minify', function () {
// CSS
gulp.src(['./bagogold/static/assets/global/css/components-md.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/global/css/'));
gulp.src(['./bagogold/static/assets/global/css/plugins-md.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/global/css/'));
gulp.src(['./bagogold/static/assets/layouts/layout3/css/*.css','!./bagogold/static/assets/layouts/layout3/css/*.min.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/layouts/layout3/css/'));
gulp.src(['./bagogold/static/assets/layouts/layout3/css/themes/*.css','!./bagogold/static/assets/layouts/layout3/css/themes/*.min.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/layouts/layout3/css/themes/'));
gulp.src(['./bagogold/static/assets/global/plugins/bootstrap/css/*.css','!./bagogold/static/assets/global/plugins/bootstrap/css/*.min.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/global/plugins/bootstrap/css/'));
gulp.src(['./bagogold/static/assets/pages/css/*.css','!./bagogold/static/assets/pages/css/*.min.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/pages/css/'));
gulp.src(['./bagogold/static/assets_jango/demos/default/css/**/*.css','!./bagogold/static/assets_jango/demos/default/css/**/*.min.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets_jango/demos/default/css/'));
gulp.src(['./bagogold/static/assets_jango/plugins/bootstrap/css/*.css','!./bagogold/static/assets_jango/plugins/bootstrap/css/*.min.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets_jango/plugins/bootstrap/css/'));
// gulp.src(['./bagogold/static/assets_jango/plugins/simple-line-icons/simple-line-icons.css']).pipe(minifyCss()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets_jango/plugins/simple-line-icons/'));
// JS
gulp.src(['./bagogold/static/assets/apps/scripts/*.js','!./bagogold/static/assets/apps/scripts/*.min.js']).pipe(uglify()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/apps/scripts/'));
gulp.src(['./bagogold/static/assets/global/scripts/*.js','!./bagogold/static/assets/global/scripts/*.min.js']).pipe(uglify()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/global/scripts/'));
gulp.src(['./bagogold/static/assets/pages/scripts/*.js','!./bagogold/static/assets/pages/scripts/*.min.js']).pipe(uglify()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/pages/scripts/'));
gulp.src(['./bagogold/static/assets/layouts/**/scripts/*.js','!./bagogold/static/assets/layouts/**/scripts/*.min.js']).pipe(uglify()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/layouts/'));
gulp.src(['./bagogold/static/js/bagogold/*.js','!./bagogold/static/js/bagogold/*.min.js']).pipe(uglify()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/js/bagogold/'));
gulp.src(['./bagogold/static/assets/global/plugins/datatables/plugins/*.js','!./bagogold/static/assets/global/plugins/datatables/plugins/*.min.js']).pipe(uglify()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets/global/plugins/datatables/plugins/'));
gulp.src(['./bagogold/static/assets_jango/base/js/*.js','!./bagogold/static/assets_jango/base/js/*.min.js']).pipe(uglify()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets_jango/base/js/'));
// gulp.src(['./bagogold/static/assets_jango/**/*.js','!./bagogold/static/assets_jango/**/*.min.js']).pipe(uglify()).pipe(rename({suffix: '.min'})).pipe(gulp.dest('./bagogold/static/assets_jango/'));
});
//*** RTL convertor task
gulp.task('rtlcss', function () {
gulp
.src(['./assets/apps/css/*.css', '!./assets/apps/css/*-rtl.min.css', '!./assets/apps/css/*-rtl.css', '!./assets/apps/css/*.min.css'])
.pipe(rtlcss())
.pipe(rename({suffix: '-rtl'}))
.pipe(gulp.dest('./assets/apps/css'));
gulp
.src(['./assets/pages/css/*.css', '!./assets/pages/css/*-rtl.min.css', '!./assets/pages/css/*-rtl.css', '!./assets/pages/css/*.min.css'])
.pipe(rtlcss())
.pipe(rename({suffix: '-rtl'}))
.pipe(gulp.dest('./assets/pages/css'));
gulp
.src(['./assets/global/css/*.css', '!./assets/global/css/*-rtl.min.css', '!./assets/global/css/*-rtl.css', '!./assets/global/css/*.min.css'])
.pipe(rtlcss())
.pipe(rename({suffix: '-rtl'}))
.pipe(gulp.dest('./assets/global/css'));
gulp
.src(['./assets/layouts/**/css/*.css', '!./assets/layouts/**/css/*-rtl.css', '!./assets/layouts/**/css/*-rtl.min.css', '!./assets/layouts/**/css/*.min.css'])
.pipe(rtlcss())
.pipe(rename({suffix: '-rtl'}))
.pipe(gulp.dest('./assets/layouts'));
gulp
.src(['./assets/layouts/**/css/**/*.css', '!./assets/layouts/**/css/**/*-rtl.css', '!./assets/layouts/**/css/**/*-rtl.min.css', '!./assets/layouts/**/css/**/*.min.css'])
.pipe(rtlcss())
.pipe(rename({suffix: '-rtl'}))
.pipe(gulp.dest('./assets/layouts'));
gulp
.src(['./assets/global/plugins/bootstrap/css/*.css', '!./assets/global/plugins/bootstrap/css/*-rtl.css', '!./assets/global/plugins/bootstrap/css/*.min.css'])
.pipe(rtlcss())
.pipe(rename({suffix: '-rtl'}))
.pipe(gulp.dest('./assets/global/plugins/bootstrap/css'));
});
//*** HTML formatter task
gulp.task('prettify', function() {
gulp.src('./**/*.html').
pipe(prettify({
indent_size: 4,
indent_inner_html: true,
unformatted: ['pre', 'code']
})).
pipe(gulp.dest('./'));
});