-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
81 lines (71 loc) · 2.8 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
'use strict';
//includes ////////////////////////////////////////////////////////////////////////////////
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
changed = require('gulp-changed');
//paths
var paths = {
scripts: 'scripts/',
wwwroot: '/'
};
paths.platform = paths.scripts + 'datasilk/';
//working paths
paths.working = {
js: {
platform: [
paths.scripts + 'selector/selector.js',
paths.scripts + 'utility/velocity.min.js', //optional 3rd-party library for animation
paths.platform + '_super.js', // <---- Datasilk Core Js: S object
paths.platform + 'ajax.js', // <---- Optional platform features
//paths.platform + 'accordion.js',
//paths.platform + 'clipboard.js',
paths.platform + 'loader.js',
paths.platform + 'message.js',
//paths.platform + 'polyfill.js',
paths.platform + 'popup.js',
paths.platform + 'svg.js',
//paths.platform + 'upload.js',
paths.platform + 'util.js',
//paths.platform + 'util.color.js',
//paths.platform + 'util.file.js',
//paths.platform + 'validate.js',
paths.platform + 'window.js',
paths.platform + 'view.js' // <---- End of Optional features
],
app: paths.app + '**/*.js',
utility: [
paths.scripts + 'utility/*.*',
paths.scripts + 'utility/**/*.*'
]
}
};
//compiled paths
paths.compiled = {
platform: paths.webroot + 'editor/js/platform.js',
js: paths.webroot + 'editor/js/',
css: paths.webroot + 'editor/css/',
app: paths.webroot + 'editor/css/',
themes: paths.webroot + 'editor/css/themes/'
};
//tasks for compiling javascript //////////////////////////////////////////////////////////////
gulp.task('js:platform', function () {
var p = gulp.src(paths.working.js.platform, { base: '.' })
.pipe(concat(paths.compiled.platform));
if (prod == true) { p = p.pipe(uglify()); }
return p.pipe(gulp.dest('.', { overwrite: true }));
});
gulp.task('js:utility', function () {
//check file changes & replace changed files in destination
return gulp.src(paths.working.js.utility)
.pipe(changed(paths.compiled.js + 'utility'))
.pipe(gulp.dest(paths.compiled.js + 'utility'));
});
gulp.task('js', gulp.series('js:platform', 'js:utility'));
//default task ////////////////////////////////////////////////////////////////////////////////
gulp.task('default', gulp.series('js'));
//watch task //////////////////////////////////////////////////////////////////////////////////
gulp.task('watch', function () {
//watch platform JS
gulp.watch(paths.working.js.platform, gulp.series('js:platform'));
});