-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (41 loc) · 1.43 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
var path = require('path'),
gulp = require('gulp'),
browserSync = require('browser-sync'),
notify = require("gulp-notify"),
cache = require('gulp-cache'),
autoprefixer = require('gulp-autoprefixer'),
imagemin = require('gulp-imagemin'),
sass = require('gulp-sass'),
cssbeautify = require('gulp-cssbeautify'),
snippets = require('sass-snippets');
// Browser Synk
gulp.task('browser-sync', function() {
browserSync({ server: true, notify: false });
});
// Слежение за JS
gulp.task('js', function() {
return gulp.src('js/**/*.js')
.pipe(browserSync.reload({stream: true}));
});
// SASS Компиляция
gulp.task('sass', function() {
return gulp.src(['sass/**/*.+(sass|scss)','!sass/bootstrap/**/*.+(sass|scss)'])
.pipe(sass({
includePaths: snippets.includePaths
}).on("error", notify.onError()))
.pipe(autoprefixer(['last 15 versions']))
.pipe(cssbeautify({indent: ' '}))
.pipe(gulp.dest('css'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('watch', ['sass', 'js', 'browser-sync'], function() {
gulp.watch('sass/**/*.+(sass|scss)', ['sass']);
gulp.watch('js/**/*.js', browserSync.reload);
gulp.watch('**/*.html', browserSync.reload);
});
gulp.task('imagemin', function() {
return gulp.src(['img/**/*','content/**/*'])
.pipe(cache(imagemin())) // Cache Images
.pipe(gulp.dest('img-min'));
});
gulp.task('default', ['watch']);