forked from axiantheme/ghostion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
107 lines (97 loc) · 4.03 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
// Load Gulp Plugins
var gulp = require('gulp'),
eventstream = require('event-stream'),
path = require('path');
sass = require('gulp-ruby-sass'),
rename = require('gulp-rename'),
minifycss = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
clean = require('gulp-clean'),
zip = require('gulp-zip');
// Compile scss Files
gulp.task('scss', function() {
return gulp.src('dev/src/scss/ghostion.scss')
.pipe(sass({style: 'expanded', quiet: true, cacheLocation: 'dev/src/scss/.sass-cache'}))
.pipe(gulp.dest('dev/dest/css'))
.pipe(minifycss())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('packages/theme/assets/css'))
.pipe(notify({message: 'SCSS Files Compiled Successfully'}));
});
// Concat JS Files
gulp.task('concat', function() {
return gulp.src([
'dev/src/framework/foundation/js/vendor/modernizr.js',
'dev/src/framework/foundation/js/foundation/foundation.js',
'dev/src/framework/foundation/js/foundation/foundation.alert.js',
'dev/src/framework/foundation/js/foundation/foundation.clearing.js',
'dev/src/framework/foundation/js/foundation/foundation.dropdown.js',
'dev/src/framework/foundation/js/foundation/foundation.interchange.js',
'dev/src/framework/foundation/js/foundation/foundation.joyride.js',
'dev/src/framework/foundation/js/foundation/foundation.magellan.js',
'dev/src/framework/foundation/js/foundation/foundation.offcanvas.js',
'dev/src/framework/foundation/js/foundation/foundation.orbit.js',
'dev/src/framework/foundation/js/foundation/foundation.reveal.js',
'dev/src/framework/foundation/js/foundation/foundation.tab.js',
'dev/src/framework/foundation/js/foundation/foundation.tooltip.js',
'dev/src/framework/foundation/js/foundation/foundation.topbar.js',
'dev/src/js/*.js'])
.pipe(concat('ghostion.js'))
.pipe(gulp.dest('dev/dest/js'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('packages/theme/assets/js'))
.pipe(notify({message: 'JavaScript Files Compiled & Compressed Successfully'}));
});
// Watch scss and JS Files
gulp.task('watch', function() {
gulp.watch('dev/src/scss/**/*.scss', ['scss']);
gulp.watch('dev/src/js/*.js', ['concat']);
});
// Zip Packages Files
gulp.task('zip', function() {
return eventstream.concat (
// Zip Theme Files
gulp.src('**', {cwd: path.join(process.cwd(), 'packages/theme')})
.pipe(zip('ghostion.zip'))
.pipe(gulp.dest('dev/tmp/theme')),
// Zip Documentation Files
gulp.src('**', {cwd: path.join(process.cwd(), 'packages/documentation')})
.pipe(zip('ghostion_documentation.zip'))
.pipe(gulp.dest('dev/tmp/documentation')),
// Zip Sources Files
gulp.src('**', {cwd: path.join(process.cwd(), 'packages/sources')})
.pipe(zip('ghostion_sources.zip'))
.pipe(gulp.dest('dev/tmp/sources')),
// Zip DemoBuilder Files
gulp.src('**', {cwd: path.join(process.cwd(), 'packages/demobuilder')})
.pipe(zip('ghostion_demobuilder.zip'))
.pipe(gulp.dest('dev/tmp/demobuilder'))
);
});
// Clean tmp Files
gulp.task('clean_tmp', function() {
gulp.src('dev/tmp', {read: false})
.pipe(clean());
});
// Clean releases Files
gulp.task('clean_releases', function() {
gulp.src('releases/**', {read: false})
.pipe(clean());
});
// Move Zip Files to releases Folder
gulp.task('move_zip', ['clean_releases'], function() {
gulp.src('dev/tmp/**/*.zip')
.pipe(gulp.dest('releases'))
.pipe(notify({message: 'All Files Released Successfully'}));
});
// Main Task: Develop
gulp.task('develop', function() {
gulp.start('scss', 'concat', 'watch');
});
// Main Task: Release
gulp.task('release', ['zip'], function() {
gulp.start('move_zip', 'clean_tmp');
});