forked from kylephillips/favorites
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
120 lines (109 loc) · 2.96 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefix = require('gulp-autoprefixer');
var livereload = require('gulp-livereload');
var notify = require('gulp-notify');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var pump = require('pump');
// Paths
var scss = 'assets/scss/**/*';
var css = 'assets/css/';
var js_admin_source = [
'assets/js/src/lib/attrchange.js',
'assets/js/src-admin/favorites-admin.settings.js',
'assets/js/src-admin/favorites-admin.listing-customizer.js',
'assets/js/src-admin/favorites-admin.factory.js'
];
var js_frontend_source = [
'assets/js/src/favorites.utilities.js',
'assets/js/src/favorites.formatter.js',
'assets/js/src/favorites.button-options-formatter.js',
'assets/js/src/favorites.user-favorites.js',
'assets/js/src/favorites.clear.js',
'assets/js/src/favorites.lists.js',
'assets/js/src/favorites.button.js',
'assets/js/src/favorites.button-updater.js',
'assets/js/src/favorites.total-count.js',
'assets/js/src/favorites.post-favorite-count.js',
'assets/js/src/favorites.require-authentication.js',
'assets/js/src/favorites.require-consent.js',
'assets/js/src/favorites.factory.js'
];
var js_compiled = 'assets/js/';
/**
* Smush the admin Styles and output
*/
gulp.task('scss', function(callback){
pump([
gulp.src(scss),
sass({ outputStyle: 'compressed' }),
autoprefix('last 15 version'),
gulp.dest(css),
livereload(),
notify('Favorites styles compiled & compressed.')
], callback);
});
/**
* Uncompressed styles
*/
gulp.task('uncompressed_styles', function(callback){
pump([
gulp.src(scss),
sass({ outputStyle: 'expanded' }),
autoprefix('last 15 version'),
rename('styles-uncompressed.css'),
gulp.dest(css)
], callback);
});
/**
* Admin Scripts
*/
gulp.task('admin_scripts', function(callback){
pump([
gulp.src(js_admin_source),
concat('favorites-admin.min.js'),
gulp.dest(js_compiled),
uglify(),
gulp.dest(js_compiled),
notify('Favorites admin scripts compiles & compressed.')
], callback);
});
/**
* Front end Scripts
*/
gulp.task('frontend_scripts', function(callback){
pump([
gulp.src(js_frontend_source),
concat('favorites.min.js'),
gulp.dest(js_compiled),
uglify(),
gulp.dest(js_compiled),
notify('Favorites front end scripts compiles & compressed.')
], callback);
});
/**
* Front end Scripts - Unminified
*/
gulp.task('frontend_scripts_pretty', function(callback){
pump([
gulp.src(js_frontend_source),
concat('favorites.js'),
gulp.dest(js_compiled)
], callback);
});
/**
* Watch Task
*/
gulp.task('watch', function(){
livereload.listen();
gulp.watch(scss, ['scss', 'uncompressed_styles']);
gulp.watch(js_admin_source, ['admin_scripts']);
gulp.watch(js_frontend_source, ['frontend_scripts']);
gulp.watch(js_frontend_source, ['frontend_scripts_pretty']);
});
/**
* Default
*/
gulp.task('default', ['scss', 'uncompressed_styles', 'admin_scripts', 'frontend_scripts', 'frontend_scripts_pretty', 'watch']);