-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
144 lines (127 loc) · 5.5 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
var gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
browserSync = require('browser-sync').create(),
babel = require('gulp-babel'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
rename = require('gulp-rename');
var sassPaths = [
'assets/components/foundation-sites/scss',
'assets/components/motion-ui/src'
];
// Process SCSS
gulp.task('sass', function () {
return gulp.src(['assets/scss/app.scss', 'assets/scss/editor.scss'])
.pipe($.sass({
includePaths: sassPaths,
outputStyle: 'compressed'
})
.on('error', $.sass.logError))
.pipe($.autoprefixer({
browsers: ['last 2 versions', 'ie >= 11']
}))
.pipe(gulp.dest('assets/css'));
});
// JSHint, concat, and minify Foundation JavaScript
gulp.task('foundation-js', function () {
return gulp.src([
// Include what-input
// './assets/components/what-input/dist/what-input.js',
// Foundation core - needed if you want to use any of the components below
'./assets/components/foundation-sites/dist/js/plugins/foundation.core.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.util.*.js',
// Pick the components you need in your project
// './assets/components/foundation-sites/dist/js/plugins/foundation.abide.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.accordion.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.accordionMenu.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.drilldown.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.dropdown.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.dropdownMenu.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.equalizer.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.interchange.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.magellan.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.offcanvas.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.orbit.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.responsiveMenu.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.responsiveToggle.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.reveal.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.slider.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.sticky.js',
'./assets/components/foundation-sites/dist/js/plugins/foundation.tabs.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.toggler.js',
// './assets/components/foundation-sites/dist/js/plugins/foundation.tooltip.js',
])
.pipe(babel({
presets: ['es2015'],
compact: true
}))
.pipe(concat('foundation.js'))
.pipe(gulp.dest('./assets/js'))
});
// JSHint, concat, and minify calendar JavaScript
gulp.task('calendar-js', function () {
return gulp.src([
'./assets/components/moment/min/moment.min.js',
'./assets/components/fullcalendar/dist/fullcalendar.min.js',
'./assets/js/modules/events/*.js'
])
.pipe(concat('calendar.js'))
.pipe(gulp.dest('./assets/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./assets/js'))
});
// JSHint, concat, and minify CHoice JavaScript
gulp.task('choice-js', function () {
return gulp.src([
'./assets/js/modules/choice/*.js',
])
.pipe(concat('choice.js'))
.pipe(gulp.dest('./assets/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./assets/js'))
});
// JSHint, concat, and minify JavaScript
gulp.task('site-js', ['foundation-js', 'calendar-js', 'choice-js'], function () {
return gulp.src([
// Grab your custom scripts
'./assets/js/foundation.js',
'./assets/components/motion-ui/motion-ui.js',
'./assets/components/magnific-popup/dist/jquery.magnific-popup.js',
'./assets/js/modules/foundation/*.js',
'./assets/js/modules/gallery/*.js',
'./assets/js/modules/portal/*.js',
'./assets/js/app.js',
])
.pipe(concat('scripts.js'))
.pipe(gulp.dest('./assets/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./assets/js'))
});
// Browser-Sync watch files and inject changes
gulp.task('browsersync', ['sass', 'site-js'], function () {
// Watch files
var files = [
'assets/css/*.css',
'assets/js/**/*.js',
'**/*.html',
'**/*.php',
'assets/images/**/*.{png,jpg,jpeg,gif,svg,webp}',
];
browserSync.init(files, {
proxy: "wisvch.dev",
notify: false
});
gulp.watch(['assets/scss/**/*.scss'], ['sass']);
gulp.watch(['assets/js/app.js'], ['site-js']);
gulp.watch(['assets/js/modules/events/*.js'], ['calendar-js']);
gulp.watch(['assets/js/modules/choice/*.js'], ['choice-js']);
});
gulp.task('default', ['sass', 'site-js'], function () {
gulp.watch(['assets/scss/**/*.scss'], ['sass']);
gulp.watch(['assets/js/app.js'], ['site-js']);
gulp.watch(['assets/js/calendar.js'], ['calendar-js']);
gulp.watch(['assets/js/w3cie.choice.js'], ['choice-js']);
});