forked from pirati-web/pirati.cz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
96 lines (81 loc) · 2.57 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
// Include gulp
var gulp = require('gulp');
// Include plugins
const concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
run = require('gulp-run');
const b = 'bower_components';
const libsjs = [
b + '/jquery/dist/jquery.js',
b + '/jquery-ui/jquery-ui.min.js',
/* TODO: replace: */
/*b + '/jquery-ui/ui/core.js',
b + '/jquery-ui/ui/widget.js',
b + '/jquery-ui/ui/position.js',
b + '/jquery-ui/ui/widgets/menu.js',
b + '/jquery-ui/ui/widgets/autocomplete.js',*/
b + '/foundation-sites/dist/foundation.js',
b + '/motion-ui/dist/motion-ui.js',
b + '/handlebars/handlebars.js',
b + '/raphael/raphael.js'
];
const c = '_includes/js/'
const customjs = [
c + 'custom.js',
c + 'kalkulacka.js',
c + 'tw.js',
c + 'fb.js',
c + 'piwik.js'
];
// Concatenate & Minify JS
gulp.task('scripts-libs', function() {
return gulp.src(libsjs)
.pipe(concat('common-libs.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('assets/js'));
});
gulp.task('scripts-custom', function() {
return gulp.src(customjs)
.pipe(concat('custom.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('assets/js'));
});
var staticHash = require('gulp-static-hash-pirati');
gulp.task('static-hash-html', function () {
return gulp.src('_includes/js/main.html')
.pipe(staticHash({
exts: ['js'],
}))
.pipe(gulp.dest('_includes/js/hashed'));
});
gulp.task('scripts', ['scripts-libs', 'scripts-custom', 'static-hash-html']);
// Deploy css
gulp.task('styles-foundation', function() {
return gulp.src([b + '/foundation-sites/scss/*/*'])
.pipe(gulp.dest('_sass/foundation'));
});
gulp.task('styles-jquery-ui', function() {
return gulp.src([b + '/jquery-ui/themes/base/jquery-ui.css'])
.pipe(rename({extname: '.scss'}))
.pipe(gulp.dest('_sass/'));
});
gulp.task('styles-font-awesome-css', function() {
return gulp.src([b + '/font-awesome/scss/*'])
.pipe(gulp.dest('_sass/font-awesome'));
});
gulp.task('styles-font-awesome-font', function() {
return gulp.src([b + '/font-awesome/fonts/*'])
.pipe(gulp.dest('assets/fonts'));
});
gulp.task('styles', ['styles-font-awesome-font', 'styles-font-awesome-css', 'styles-foundation', 'styles-jquery-ui']);
// Runs Jekyll build
gulp.task('build', ['scripts', 'styles'], function() {
var shellCommand = 'bundle exec jekyll build';
return gulp.src('.')
.pipe(run(shellCommand));
});
// Default Task
gulp.task('default', ['scripts', 'styles']);