-
Notifications
You must be signed in to change notification settings - Fork 15
/
gulpfile.js
57 lines (53 loc) · 1.29 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
const gulp = require("gulp");
const del = require("del");
const autoprefixer = require("gulp-autoprefixer");
const cleanCss = require("gulp-clean-css");
const rename = require("gulp-rename");
const sass = require("gulp-sass");
const sourcemaps = require("gulp-sourcemaps");
const uglify = require("gulp-uglify");
gulp.task("css", () => gulp
// get all scss files
.src("ios7.scss")
// make a sourcemap
.pipe(sourcemaps.init())
// run it through sass
.pipe(sass.sync({
includePaths: [ "node_modules" ]
}))
// add prefixes as needed
.pipe(autoprefixer())
// make it ugly
.pipe(cleanCss())
// add minified suffix
.pipe(rename({ suffix: ".min" }))
// write the sourcemaps
.pipe(sourcemaps.write("."))
// write the file
.pipe(gulp.dest("."))
);
gulp.task("js", () => gulp
// get all js files
.src([ "ios7.js" ])
// make a sourcemap
.pipe(sourcemaps.init())
// make it ugly
.pipe(uglify({
output: {
comments: /^!|@preserve|@license/
}
}))
// add minified suffix
.pipe(rename({ suffix: ".min" }))
// write the sourcemaps
.pipe(sourcemaps.write("."))
// write the file
.pipe(gulp.dest("."))
);
gulp.task("clean", () => del([
"ios7.min.css",
"ios7.min.css.map",
"ios7.min.js",
"ios7.min.js.map"
]));
gulp.task("default", gulp.series([ "clean", gulp.parallel([ "css", "js" ]) ]));