-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
65 lines (60 loc) · 1.5 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
var gulp = require("gulp"),
clean = require("gulp-clean"),
concat = require("gulp-concat"),
rename = require("gulp-rename"),
replace = require("gulp-replace"),
uglify = require("gulp-uglify"),
minifyCss = require("gulp-minify-css"),
zip = require("gulp-zip");
/**
* Remove dist directory
*/
gulp.task("clean", function () {
return gulp.src("dist", {read: false}).pipe(clean());
});
/**
* generate plugin.min.js
*/
gulp.task("plugin", function () {
return gulp
.src("plugin.js")
.pipe(uglify({preserveComments: "some"}))
.pipe(rename("plugin.min.js"))
.pipe(gulp.dest("tmp/"));
});
/**
* Concat and minify CSS
*/
gulp.task("css", function () {
return gulp
.src(["styles.min.css"])
.pipe(concat("styles.css"))
.pipe(minifyCss())
.pipe(gulp.dest("tmp/css/"));
});
/**
* Build distribuable package
**/
gulp.task("dist", ["clean", "css", "plugin"], function () {
return gulp
.src([
"img/**/*",
"langs/**/*",
"tmp/**/*",
"css/**/*",
"LICENCE",
"plugin.js",
"README.md"
], {base: "."})
.pipe(rename(function (path) {
path.dirname = "fontawesome/" + path.dirname.replace(/^tmp\/*/, "");
}))
.pipe(zip("fontawesome.zip"))
.pipe(gulp.dest("dist/"))
});
/**
* Build and remove temps
*/
gulp.task("default", ["dist"], function () {
return gulp.src("tmp", {read: false}).pipe(clean());
});