forked from pupil-labs/pupil-docs-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
65 lines (56 loc) · 1.92 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
// load all required libraries
var gulp = require('gulp');
var gutil = require('gulp-util');
// node filesystem
var fs = require('fs');
// plugins - site
var prefixer = require('gulp-autoprefixer');
var plumber = require('gulp-plumber');
var cleancss = require('gulp-clean-css');
var concat = require('gulp-concat');
var runSeq = require('run-sequence');
// =================================================================
// css build task(
// ================================================================= )
gulp.task("css:main", function() {
return gulp.src("./assets/css/main.css")
.pipe(cleancss())
.pipe(prefixer({
browsers: ["last 2 versions"],
cascade: true, // prettify browser prefixes
remove: true // remove un-needed prefixes
}))
.pipe(concat('main.min.css'))
.pipe(gulp.dest("./static/stylesheets"))
});
gulp.task("css:screen", function() {
gulp.src("./assets/css/screen.css")
.pipe(cleancss())
.pipe(prefixer({
browsers: ["last 2 versions"],
cascade: true, // prettify browser prefixes
remove: true // remove un-needed prefixes
}))
.pipe(concat('screen.min.css'))
.pipe(gulp.dest("./static/stylesheets"))
});
gulp.task('css:all', function() {
return runSeq(['css:main','css:screen'])
});
// =================================================================
// image min task(
// ================================================================= )
gulp.task('image_min', function() {
options = {
resize: [1440,1440],
quality: 85,
progressive: true,
compressionLevel: 6,
sequentialRead: true,
trellisQuantisation: false
}
return gulp.src('build/media/images/**/*.{jpg,png}',{base: './'})
.pipe(plumber())
.pipe(image_min(options))
.pipe(gulp.dest('./'))
});