-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (76 loc) · 2.21 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
74
75
76
77
78
79
80
81
82
83
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
plumber = require('gulp-plumber'),
concat = require('gulp-concat'),
cssnano = require('gulp-cssnano'),
uncss = require('gulp-uncss'),
strip = require('gulp-strip-css-comments'),
rename = require('gulp-rename');
////////////////////////////////////////
// Scripts
////////////////////////////////////////
/*gulp.task('scripts', function() {
gulp.src(['assets/js/test.js', '!assets/js/!*.min.js'])
.pipe(plumber())
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('assets/js'))
.pipe(reload({stream: true}));
});*/
////////////////////////////////////////
// Css
////////////////////////////////////////
gulp.task('uncss', function() {
"use strict";
gulp.src(['assets/css/font-awesome.min.css', 'assets/css/main.css', 'assets/css/tooltip.css'])
.pipe(plumber())
.pipe(concat('app.css'))
.pipe(uncss({
html: ['index.html'],
timeout: 2000,
ignore: ['a.tooltip:after', 'a.tooltip:hover:after', 'a.tooltip']
}))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: true
}))
.pipe(strip({preserve: false}))
//.pipe(cssnano())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('assets/css'))
.pipe(reload({stream: true}));
});
////////////////////////////////////////
// HTML
////////////////////////////////////////
gulp.task('html', function() {
"use strict";
gulp.src('index.html')
.pipe(reload({stream:true}));
});
////////////////////////////////////////
// Browser-Sync
////////////////////////////////////////
gulp.task('browser-sync', function() {
"use strict";
browserSync({
server: {
baseDir: './'
}
});
});
////////////////////////////////////////
// Watch
////////////////////////////////////////
gulp.task('watch', function() {
"use strict";
//gulp.watch('assets/js/test.js', ['scripts']);
gulp.watch('index.html', ['html']);
gulp.watch('assets/css/main.css', ['uncss']);
});
////////////////////////////////////////
// Default
////////////////////////////////////////
gulp.task('default', ['uncss', 'html', 'browser-sync', 'watch']);