forked from craftcms/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
93 lines (81 loc) · 3.7 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
// TODO: following deps are still manual:
// - colorpicker
// - datepicker-i18n
// - fileupload
// - jquery-touch-events
// - jquery-ui
// - qunit
var es = require('event-stream');
var gulp = require('gulp');
var concat = require('gulp-concat');
var jsonMinify = require('gulp-json-minify');
var rename = require('gulp-rename');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var libPath = 'lib/';
var jsDeps = [
{ srcGlob: 'node_modules/bootstrap/dist/js/bootstrap.js', dest: libPath+'bootstrap/js' },
{ srcGlob: 'node_modules/d3/build/d3.js', dest: libPath+'d3' },
{ srcGlob: 'node_modules/element-resize-detector/dist/element-resize-detector.js', dest: libPath+'element-resize-detector' },
{ srcGlob: 'node_modules/fabric/dist/fabric.js', dest: libPath+'fabric' },
{ srcGlob: 'node_modules/garnishjs/dist/garnish.js', dest: libPath+'garnishjs' },
{ srcGlob: 'node_modules/inputmask/dist/jquery.inputmask.bundle.js', dest: libPath+'inputmask' },
{ srcGlob: 'node_modules/jquery/dist/jquery.js', dest: libPath+'jquery' },
{ srcGlob: 'node_modules/jquery.payment/lib/jquery.payment.js', dest: libPath+'jquery.payment' },
{ srcGlob: 'node_modules/picturefill/dist/picturefill.js', dest: libPath+'picturefill' },
{ srcGlob: 'node_modules/punycode/punycode.js', dest: libPath+'punycode' },
{ srcGlob: 'node_modules/selectize/dist/js/standalone/selectize.js', dest: libPath+'selectize' },
{ srcGlob: 'node_modules/timepicker/jquery.timepicker.js', dest: libPath+'timepicker' },
{ srcGlob: 'node_modules/velocity-animate/velocity.js', dest: libPath+'velocity' },
{ srcGlob: 'node_modules/xregexp/xregexp-all.js', dest: libPath+'xregexp' },
{ srcGlob: 'node_modules/yii2-pjax/jquery.pjax.js', dest: libPath+'yii2-pjax' },
{ srcGlob: 'node_modules/vue/dist/vue.js', dest: libPath+'vue' },
{ srcGlob: 'node_modules/vue/dist/vue.min.js', dest: libPath+'vue' },
{ srcGlob: 'node_modules/vue-router/dist/vue-router.js', dest: libPath+'vue-router' },
{ srcGlob: 'node_modules/vuex/dist/vuex.js', dest: libPath+'vuex' },
{ srcGlob: 'node_modules/axios/dist/axios.js', dest: libPath+'axios' }
];
var d3LocaleData = [
{ srcGlob: 'node_modules/d3-format/locale/*.json', dest: libPath+'d3-format' },
{ srcGlob: 'node_modules/d3-time-format/locale/*.json', dest: libPath+'d3-time-format' }
];
var staticDeps = [
{ srcGlob: 'node_modules/bootstrap/dist/css/*', dest: libPath+'bootstrap/css' },
{ srcGlob: 'node_modules/bootstrap/dist/fonts/*', dest: libPath+'bootstrap/fonts' },
{ srcGlob: 'node_modules/selectize/dist/css/selectize.css', dest: libPath+'selectize' }
];
gulp.task('deps', function() {
var streams = [];
// Minify & move the JS deps
jsDeps.forEach(function(dep) {
streams.push(
gulp.src(dep.srcGlob)
//.pipe(gulp.dest(dest))
.pipe(sourcemaps.init())
.pipe(uglify())
//.pipe(rename({ suffix: '.min' }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(dep.dest))
);
});
// Minify & move the D3 locale JSON
d3LocaleData.forEach(function(dep) {
streams.push(
gulp.src(dep.srcGlob)
.pipe(jsonMinify())
.pipe(gulp.dest(dep.dest))
);
});
// Statically move over any dep files we don't need to modify
staticDeps.forEach(function(dep) {
streams.push(
gulp.src(dep.srcGlob)
.pipe(gulp.dest(dep.dest))
);
});
return es.merge(streams);
});
gulp.task('sass', function() {
return gulp.src('node_modules/craftcms-sass/src/_mixins.scss')
.pipe(gulp.dest('lib/craftcms-sass'));
});