-
Notifications
You must be signed in to change notification settings - Fork 0
/
_gulpfile.js
318 lines (307 loc) · 12.9 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
// Include gulp
var gulp = require('gulp');
// Define base folders
var builder = 'builder';
var core = builder + '/_core';
var base = builder + '/_baseCore';
// DEFINE PROJECT APP: enter project folder
var app = builder + '/digivox';
// DEFINE PROJECT SITE: enter project folder
var cms = builder + '/_aeapb';
// ------------------------------------
var common = core + '/common';
var commonApp = app + '/common';
var commonBase = base + '/common';
var commonCms = cms + '/common';
var tmpl = 'template';
var tmplJS = tmpl + '/js';
var tmplCSS = tmpl + '/css';
// CORE -----------------------------
// JS files
var coreJs = core+'/js/core.js'; // General implementations of CORE
var menuJs = core+'/common/libs/jquery-mmenu/jquery.mmenu.min.all.js'; // jQuery menu mobile 'mmenu' plugin
var formsJs = [
core+'/js/core.forms.js', // Implementations of CORE for forms
core+'/js/forms/jquery.autotab-1.1b.js', // Auto tab functionality
core+'/js/forms/jquery.inputmask.bundle.js', // Plugin for masks in text fields
core+'/js/forms/jquery.price_format.min.js', // Formats the price in text fields
core+'/js/bootstrap/bootstrap-field-context.js' // Method for assigning the field validation classes of bootstrap
];
var validateJs = [
core+'/js/forms/jquery-validation/jquery.validate.min.js', // jQuery validation plugin
core+'/js/forms/jquery-validation/additional-methods.min.js', // jQuery validation plugin addon
core+'/js/core.validation.js' // Customizations for validation
];
// Default JS -> Javascript libraries loaded by default
var _defaultJs = [
core+'/bootstrap/js/bootstrap.min.js', // Bootstrap functionalities
core+'/js/bootstrap/bootstrap-tabdrop.js', // Plugin to compress the tabs or pills when it exceeds the maximum width
core+'/js/bootstrap/bootstrap-hover-dropdown.min.js', // Plugin to display/hide the dropdown in Hover event
// core+'/js/bootstrap/bootstrap-table.js', // Option for dynamic table with order, pagination, etc...
core+'/js/content/jquery.actual.js', // Get dimensions of the hidden elements
core+'/common/libs/chosen/chosen.jquery.min.js', // Formats the fields of type 'select'
core+'/js/content/fontsize.js', // Own method to increase/decrease the font size on the page body
core+'/js/browser/respond.min.js', // script to enable responsive web designs in browsers that don't support CSS3 Media Queries - in particular, Internet Explorer 8 and under
//core+'/js/browser/SmoothScroll.js', // script to set smooth scroll from browser
core+'/common/libs/fitvids/jquery.fitvids.js', // fluid embed videos
core+'/js/ie.core.js' // General implementations of CORE
];
// APP -----------------------------
// JS files
var customAppJs = [app+'/js/custom.js'];
var appJs = [
core+'/common/libs/js/browser/css_browser_selector.js', // Plugin to set the user browser used
menuJs,
coreJs
];
var defaultAppJs = _defaultJs.concat(appJs, formsJs, customAppJs);
var guideAppJs = app+'/js/guide.js'; // Methods and specific style guide features
// CSS files
var appCss = app+'/sass/style.scss'; // General css stylesheet
var appPrintCss = app+'/sass/style.print.scss'; // Stylesheet for printing
var appIeCss = app+'/sass/style.ie.scss'; // Specific style sheet for IE
var appEditorCss = app+'/sass/style.editor.scss'; // Stylesheet to be used in text editors
var appGuideCss = app+'/sass/style.guide.scss'; // Specific style sheet for style guide
// CMS -----------------------------
// JS files
var customCmsJs = [cms+'/js/custom.js']; // Specific customizations from froject
var cmsJs = [base+'/core/js/cms.frontend.js']; // Specific customizations from CMS
var defaultCmsJs = _defaultJs.concat(cmsJs, customCmsJs);
var guideCmsJs = cms+'/js/guide.js'; // Methods and specific style guide features
// CSS files
var cmsCss = cms+'/sass/style.scss'; // General css stylesheet
var cmsAppCss = cms+'/sass/style.base.app.scss'; // General css stylesheet
var cmsPrintCss = cms+'/sass/style.print.scss'; // Stylesheet for printing
var cmsIeCss = cms+'/sass/style.ie.scss'; // Specific style sheet for IE
var cmsEditorCss = cms+'/sass/style.editor.scss'; // Stylesheet to be used in text editors
var cmsGuideCss = cms+'/sass/style.guide.scss'; // Specific style sheet for style guide
var cmsContentArticleCss = cms+'/sass/style.content.article.scss'; // Specific style sheet for content articles
var cmsContentListCss = cms+'/sass/style.content.list.scss'; // Specific style sheet for content lists
var cmsContentListGalleryCss = cms+'/sass/style.content.list.gallery.scss'; // Specific style sheet for content lists gallery
var cmsContentMediaGalleryCss = cms+'/sass/style.content.media-gallery.scss'; // Specific style sheet for content media gallery
var cmsNavbarCss = base+'/core/sass/cms.frontend.navbar.scss'; // Stylesheet for administrator navbar in frontend
var cmsAdminCss = base+'/core/sass/cms.admin.scss'; // Specific customizations from CMS Administration area
// Include plugins
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var del = require('del');
// TASKS
// JS -----------------------------
// core.js
// APP
gulp.task('app-core.js', function() {
return gulp.src(coreJs)
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// CMS
gulp.task('cms-core.js', function() {
return gulp.src(coreJs)
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// forms.js
// APP
gulp.task('app-forms.js', function() {
return gulp.src(formsJs)
.pipe(concat('forms.js'))
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// CMS
gulp.task('cms-forms.js', function() {
return gulp.src(formsJs)
.pipe(concat('forms.js'))
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// validate.js
// APP
gulp.task('app-validate.js', function() {
return gulp.src(validateJs)
.pipe(concat('validate.js'))
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// CMS
gulp.task('cms-validate.js', function() {
return gulp.src(validateJs)
.pipe(concat('validate.js'))
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// style.guide.js
// APP
gulp.task('app-style.guide.js', function() {
return gulp.src(guideAppJs)
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// CMS
gulp.task('cms-style.guide.js', function() {
return gulp.src(guideCmsJs)
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// default.js
// APP
gulp.task('app-default.js', function() {
return gulp.src(defaultAppJs)
.pipe(concat('default.js'))
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// CMS
gulp.task('cms-default.js', function() {
return gulp.src(defaultCmsJs)
.pipe(concat('default.js'))
.pipe(uglify())
.pipe(gulp.dest(tmplJS))
});
// CSS -----------------------------
// style.editor.css
// APP
gulp.task('app-style.editor.css', function() {
gulp.src(appEditorCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// CMS
gulp.task('cms-style.editor.css', function() {
gulp.src(cmsEditorCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// style.guide.css
// APP
gulp.task('app-style.guide.css', function() {
gulp.src(appGuideCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// CMS
gulp.task('cms-style.guide.css', function() {
gulp.src(cmsGuideCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// style.ie.css
// APP
gulp.task('app-style.ie.css', function() {
gulp.src(appIeCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// CMS
gulp.task('cms-style.ie.css', function() {
gulp.src(cmsIeCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// style.css
// APP
gulp.task('app-style.css', function() {
gulp.src(appCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// CMS
gulp.task('cms-style.css', function() {
gulp.src(cmsCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// style.print.css
// APP
gulp.task('app-style.print.css', function() {
gulp.src(appPrintCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// CMS
gulp.task('cms-style.print.css', function() {
gulp.src(cmsPrintCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// CMS's
// cms.style.base.app.css
gulp.task('cms-style.base.app.css', function() {
gulp.src(cmsAppCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// cms.frontend.navbar.css
gulp.task('cms.frontend.navbar.css', function() {
gulp.src(cmsNavbarCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// cms.admin.css
gulp.task('cms.admin.css', function() {
gulp.src(cmsAdminCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// style.content.article.css
gulp.task('style.content.article.css', function() {
gulp.src(cmsContentArticleCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// style.content.list.css
gulp.task('style.content.list.css', function() {
gulp.src(cmsContentListCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// style.content.list.gallery.css
gulp.task('style.content.list.gallery.css', function() {
gulp.src(cmsContentListGalleryCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// style.content.media-gallery.css
gulp.task('style.content.media-gallery.css', function() {
gulp.src(cmsContentMediaGalleryCss)
.pipe(sass({outputStyle: 'compressed', precision: 10}))
.pipe(gulp.dest(tmplCSS))
});
// COPY TEMPLATE LIBS
// CORE
gulp.task('build-common', function() {
gulp.src(common+'/**/*', {base: common})
.pipe(gulp.dest(tmpl+'/core'))
});
// APP
gulp.task('app-build-common', function() {
gulp.src(commonApp+'/**/*', {base: commonApp})
.pipe(gulp.dest(tmpl))
});
// BASE
gulp.task('base-build-common', function() {
gulp.src(commonBase+'/**/*', {base: commonBase})
.pipe(gulp.dest(tmpl))
});
// CMS
gulp.task('cms-build-common', function() {
gulp.src(commonCms+'/**/*', {base: commonCms})
.pipe(gulp.dest(tmpl))
});
// CLEAN PROJECT
var tmplClean = [tmpl+'/**', '!'+tmpl];
gulp.task('_reset', function() { del(tmplClean) });
// Builder JS
gulp.task('app-builder-js', ['app-core.js', 'app-forms.js', 'app-validate.js', 'app-style.guide.js', 'app-default.js']);
gulp.task('cms-builder-js', ['cms-core.js', 'cms-forms.js', 'cms-validate.js', 'cms-style.guide.js', 'cms-default.js']);
// Builder CSS
gulp.task('app-builder-css', ['app-style.editor.css', 'app-style.guide.css', 'app-style.ie.css', 'app-style.css', 'app-style.print.css']);
gulp.task('cms-builder-css', ['cms-style.editor.css', 'cms-style.guide.css', 'cms-style.ie.css', 'cms-style.css', 'cms-style.base.app.css', 'cms-style.print.css', 'cms.frontend.navbar.css', 'cms.admin.css', 'style.content.article.css', 'style.content.list.css', 'style.content.list.gallery.css', 'style.content.media-gallery.css']);
// Builder Template
// APP
gulp.task('_builder-app', ['build-common', 'app-build-common', 'app-builder-js', 'app-builder-css']);
// CMS
gulp.task('_builder-cms', ['build-common', 'base-build-common', 'cms-build-common', 'cms-builder-js', 'cms-builder-css']);
gulp.task('_builder-custom', ['cms-build-common']); // In separate because this overwrite custom files