-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
86 lines (77 loc) · 2.29 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
84
85
86
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
sourcemaps = require('gulp-sourcemaps'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
del = require('del');
cmq = require('gulp-combine-media-queries'),
iconfont = require('gulp-iconfont'),
iconfontCss = require('gulp-iconfont-css'),
browserSync = require('browser-sync').create(),
reload = browserSync.reload,
fontName = 'Icons';
gulp.task('serve', function() {
browserSync.init({ proxy: "" }); // heyyyy don't forget to update this to your local project address
gulp.watch("**/*.scss", ['styles']);
gulp.watch("**/*.php").on('change', reload);
});
gulp.task('styles', function() {
return sass('css/style.scss', { style: 'compressed', sourcemap: false })
.pipe(autoprefixer('last 3 version'))
.on('error', function (err) { console.log(err.message); })
.pipe(cmq({
log: true
}))
.pipe(gulp.dest('css'))
.pipe(reload({stream: true}))
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('iconfont', function(){
gulp.src(['img/icons/*.svg'])
.pipe(iconfontCss({
fontName: fontName,
fontPath: 'fonts/',
targetPath: '_icons.scss'
}))
.pipe(iconfont({
fontName: fontName,
fontHeight: 1001,
normalize: true
}))
.pipe(gulp.dest('css/fonts/'));
});
gulp.task('images', function() {
return gulp.src('img/**/*')
.pipe(cache(imagemin({ optimizationLevel: 5, progressive: true, interlaced: true })))
.pipe(gulp.dest('img'))
.pipe(notify({ message: 'Images task complete' }));
});
gulp.task('cmq', function () {
gulp.src('css/**/*.css')
.pipe(cmq({
log: true
}))
.pipe(gulp.dest('css'));
});
gulp.task('scripts', function() {
return gulp.src('js/**/*')
.pipe(concat('build.js'))
.pipe(gulp.dest('./dist/'))
.pipe(notify({ message: 'Js build complete' }));
});
gulp.task('default', function() {
gulp.start('styles', 'images');
});
gulp.task('watch', function() {
gulp.watch('css/**/*.scss', ['styles']);
});
gulp.task('concat', function() {
gulp.watch('js/**/*', ['scripts']);
});