-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (42 loc) · 1.32 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
"use strict";
var gulp = require("gulp");
var sass = require("gulp-sass");
var sourcemaps = require("gulp-sourcemaps");
var autoprefixer = require("gulp-autoprefixer");
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var plumber = require('gulp-plumber');
var ghPages = require('gulp-gh-pages');
var target = {
stylesheet_src : "./assets/stylesheets/**/*.scss",
stylesheet_dist : "./stylesheets/",
images_src : "./assets/images/*",
images_dist : "./images/",
}
gulp.task("stylesheets", function () {
gulp.src(target.stylesheet_src)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(autoprefixer())
.pipe(sass({outputStyle: "compressed"}).on("error", sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest(target.stylesheet_dist))
});
gulp.task("images", function () {
return gulp.src(target.images_src)
.pipe(plumber())
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest(target.images_dist));
});
gulp.task('deploy', function() {
return gulp.src('./_site/**/*')
.pipe(ghPages());
});
gulp.task("watch", function() {
gulp.watch(target.stylesheet_src, ["stylesheets"]);
});
gulp.task("default", ["stylesheets", "watch"]);