-
Notifications
You must be signed in to change notification settings - Fork 12
/
gulpfile.js
73 lines (56 loc) · 1.88 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
// TODO Add copyright and license information
'use strict';
const _ = require('gulp-load-plugins')();
const del = require('del');
const gulp = require('gulp');
const pkg = require('./package.json');
// ----------------------------------------------------------------------------
// CONFIG
// ----------------------------------------------------------------------------
const libraryName = 'audi-type';
const banner = `/**
* ${pkg.name} - ${pkg.description}
* @version v${pkg.version}
* @copyright ${new Date().getFullYear()} ${pkg.author}
* @link ${pkg.homepage}
*/\n`;
// ----------------------------------------------------------------------------
// Build
// ----------------------------------------------------------------------------
gulp.task('build:css', function() {
return gulp.src('src/scss/*.scss')
.pipe(_.plumber())
.pipe(_.sass({
precision: 10
}))
.pipe(_.header(banner))
.pipe(gulp.dest('dist/css'))
.pipe(_.if('*.css', _.csso()))
.pipe(_.header(banner))
.pipe(_.rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist/css'))
.pipe(_.size({
title: _.util.colors.underline('CSS size:') + '\n',
showFiles: true,
showTotal: false,
gzip: true
}));
});
gulp.task('build:copy-fonts', function() {
return gulp.src('src/fonts/*.+(eot|svg|ttf|woff|woff2)')
.pipe(gulp.dest('dist/fonts'));
});
gulp.task('build:copy-files', function() {
return gulp.src(['src/*.html', 'src/.htaccess'])
.pipe(gulp.dest('dist'));
});
gulp.task('clean', function() {
return del(['dist/css', 'dist/fonts']);
});
gulp.task('build', gulp.series('clean', 'build:css', 'build:copy-fonts', 'build:copy-files'));
// ----------------------------------------------------------------------------
// DEFAULT
// ----------------------------------------------------------------------------
gulp.task('default', gulp.series('build'));