-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
53 lines (46 loc) · 1.65 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var cleanCSS = require('gulp-clean-css');
var imagemin = require('gulp-imagemin');
var replace = require('gulp-replace');
var htmlmin = require('gulp-htmlmin');
var minify = require('gulp-minify');
var browserSync = require('browser-sync').create();
gulp.task('fonts', function(){
return gulp.src('fonts/*')
.pipe(gulp.dest('build/fonts'))
});
gulp.task('css', function(){
return gulp.src(['css/normalize.css', 'css/webflow.css', 'yourstyle.webflow.css'])
.pipe(concat('style.min.css'))
.pipe(cleanCSS())
.pipe(gulp.dest('build/css'))
});
gulp.task('images', function(){
return gulp.src('images/*')
.pipe(imagemin())
.pipe(gulp.dest('build/images'))
});
gulp.task('javascript', function(){
return gulp.src('js/*')
.pipe(minify())
.pipe(gulp.dest('build/js'))
});
gulp.task('html', ['javascript', 'css', 'fonts', 'images'], function(){
return gulp.src('*.html')
.pipe(replace('<link href="css/normalize.css" rel="stylesheet" type="text/css">',''))
.pipe(replace('<link href="css/webflow.css" rel="stylesheet" type="text/css">',''))
.pipe(replace('css/yourstyle.webflow.css','css/style.min.css'))
.pipe(replace('<script src="js/modernizr.js','<script async src="js/modernizr-min.js'))
.pipe(replace('js/webflow.js','js/webflow-min.js'))
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('build'))
});
gulp.task('browser-sync', ['html'], function() {
browserSync.init({
server: {
baseDir: "./build"
}
});
});
gulp.task('default', ['fonts', 'css', 'images', 'javascript', 'html', 'browser-sync']);