-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
107 lines (84 loc) · 2.77 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
var gulp = require('gulp');
var pkg = require('./package.json');
var clean = require('gulp-clean');
var rename = require('gulp-rename');
var less = require('gulp-less');
var imagemin = require('gulp-imagemin');
var header = require('gulp-header');
var banner = '/*!\n' +
' * Skypecon v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
' * Copyright 2014 <%= pkg.author %>\n' +
' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
' */\n\n';
gulp.task('watch:less', function () {
gulp.watch('./src/less/*.less', ['less:dev']);
});
gulp.task('copy:dev', function () {
gulp.src('./src/*.html')
.pipe(gulp.dest('./dev'));
gulp.src('./src/emoticons/stills*.png')
.pipe(gulp.dest('./dev/img'));
gulp.src('./src/emoticons/anim/*.png')
.pipe(rename({suffix: "_anim"}))
.pipe(gulp.dest('./dev/img'));
gulp.src('./src/emoticons/anim@2x/*.png')
.pipe(rename({suffix: "_anim@2x"}))
.pipe(gulp.dest('./dev/img'));
});
// Be sure the `ulimit -n 1024` is increased in .bash_profile
gulp.task('imagemin:dist', function() {
gulp.src('./src/emoticons/stills*.png')
.pipe(imagemin())
.pipe(gulp.dest('./dist/img'));
gulp.src('./src/emoticons/anim/*.png')
.pipe(imagemin())
.pipe(rename({suffix: "_anim"}))
.pipe(gulp.dest('./dist/img'));
gulp.src('./src/emoticons/anim@2x/*.png')
.pipe(imagemin())
.pipe(rename({suffix: "_anim@2x"}))
.pipe(gulp.dest('./dist/img'));
});
gulp.task('less:dev', function () {
gulp.src('./src/less/' + pkg.name + '.less')
.pipe(less({
//yuicompress: true,
dumpLineNumbers: 'comments'
}))
.pipe(gulp.dest('./dev/css'));
});
gulp.task('less:dist', function () {
gulp.src('./src/less/' + pkg.name + '.less')
.pipe(less())
.pipe(header(banner, {pkg : pkg}))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('less:minify', function () {
gulp.src('./src/less/' + pkg.name + '.less')
.pipe(less({
//report: 'gzip',
compress: true
}))
.pipe(rename({
suffix: ".min"
}))
.pipe(header(banner, {pkg : pkg}))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('clean:dev', function () {
return gulp.src('./dev', {read: false})
.pipe(clean());
});
gulp.task('clean:dist', function () {
return gulp.src('./dist', {read: false})
.pipe(clean());
});
gulp.task('clean:all', ['clean:dev', 'clean:dist'], function () {
gulp.src('./node_modules', {read: false})
.pipe(clean());
});
gulp.task('build:dev', ['less:dev', 'copy:dev']);
gulp.task('build:dist', ['clean:dist', 'imagemin:dist', 'less:dist', 'less:minify']);
gulp.task('default', ['build:dist'], function () {
// place [additional] code for your default task here
});