This repository has been archived by the owner on Sep 30, 2022. It is now read-only.
/
gulpfile.js
115 lines (93 loc) · 2.53 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
var gulp = require('gulp');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var header = require('gulp-header');
var uglify = require('gulp-uglify');
var stylus = require('gulp-stylus');
var autoprefixer = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var cleanhtml = require('gulp-cleanhtml');
var imagemin = require('gulp-imagemin');
gulp.task('clean_js', function () {
'use strict';
return gulp.src(
[
'./static/js/min'
],
{
read: false
})
.pipe(clean());
});
gulp.task('js', ['clean_js'], function () {
'use strict';
gulp.src(
[
'./static/js/shadowbox.js'
])
.pipe(concat('shadowbox.js'))
.pipe(uglify())
.pipe(gulp.dest('./static/js/min'));
return gulp.src(
[
'./static/js/base.js'
])
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(header('// enzyme-project.org ' + new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '') + '\n'))
.pipe(gulp.dest('./static/js/min'));
});
gulp.task('clean_css', function () {
'use strict';
return gulp.src(
[
'./static/css/min'
],
{
read: false
})
.pipe(clean());
});
gulp.task('css', ['clean_css'], function () {
'use strict';
return gulp.src(
[
'./static/css/style.styl'
])
.pipe(concat('all.css'))
.pipe(stylus({
use: ['nib']
}))
.pipe(autoprefixer('last 1 version', '> 1%', 'ie 8', 'ie 7'))
.pipe(minifyCSS({
'removeEmpty': true
}))
.pipe(header('/* enzyme-project.org ' + new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '') + '*/\n'))
.pipe(gulp.dest('./static/css/min'));
});
gulp.task('clean_html', function () {
'use strict';
return gulp.src(
[
'./templates/min'
],
{
read: false
})
.pipe(clean());
});
gulp.task('html', ['clean_html'], function () {
'use strict';
return gulp.src('./templates/**/*.html')
.pipe(cleanhtml())
.pipe(gulp.dest('./templates/min'));
});
gulp.task('img', function () {
'use strict';
return gulp.src('./static/img/**/*')
.pipe(imagemin())
.pipe(gulp.dest('./static/img'));
});
gulp.task('default', [
'js', 'css', 'html', 'img'
]);