-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
97 lines (85 loc) · 2.85 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
'use strict';
var gulp = require('gulp');
var del = require('del');
var run = require('run-sequence');
var $ = require('gulp-load-plugins')();
var manifest = {
path: 'manifest.json'
};
gulp.task('styles', function () {
return gulp.src('dev/styles/main.scss')
.pipe($.plumber())
.pipe($.sass({errLogToConsole: true}))
.pipe($.autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(gulp.dest('dev/dist/css'));
});
gulp.task('scripts', function () {
return gulp.src('dev/js/theme.js')
.pipe($.jshint())
.pipe($.jshint.reporter('default'))
.pipe($.concat('main.js', {
newLine: ';'
}))
.pipe($.uglify())
.pipe(gulp.dest('dev/dist/js'));
});
gulp.task('scripts-vendor', function () {
return gulp.src([
'dev/bower_components/jquery/dist/jquery.js',
'dev/bower_components/fastclick/lib/fastclick.js',
'dev/bower_components/foundation/js/foundation/foundation.js',
'dev/bower_components/foundation/js/foundation/foundation.dropdown.js',
'dev/bower_components/foundation/js/foundation/foundation.topbar.js',
'dev/bower_components/headroom.js/dist/headroom.js',
'dev/bower_components/headroom.js/dist/jQuery.headroom.js',
'../../plugins/customizable-sharing-buttons/js/smpl-share.js',
'../../plugins/customizable-sharing-buttons/js/sharing-buttons.js'
])
.pipe($.concat('vendor.js', {newLine: ';'}))
.pipe($.uglify())
.pipe(gulp.dest('dev/dist/js'));
});
gulp.task('scss-lint', function() {
return gulp.src("dev/style/**/*.scss")
.pipe($.scssLint());
});
gulp.task('clean', function(cb) {
del([
"assets/css/main*.css",
"assets/js/main*.js",
"assets/js/vendor*.js"
], cb);
});
gulp.task('clean-original', function(cb) {
del([
"assets/css/main.css",
"assets/js/main.js",
"assets/js/vendor.js"
], cb);
});
gulp.task('version', function () {
return gulp.src([
"dev/dist/css/main.css",
"dev/dist/js/vendor.js",
"dev/dist/js/main.js"
], {base: "dev/dist"})
.pipe(gulp.dest("assets"))
.pipe($.rev())
.pipe(gulp.dest("assets"))
.pipe($.rev.manifest(manifest))
.pipe(gulp.dest("assets"));
});
gulp.task('notify', function(){
return gulp.src("./")
.pipe($.notify("Build complete!"));
});
gulp.task('watch', function () {
gulp.watch('dev/styles/**/*.scss', ['styles', 'version']);
});
gulp.task('build', ['clean'], function(callback) {
run(['styles', 'scripts', 'scripts-vendor'],
'version',
'clean-original',
'notify',
callback);
});