-
Notifications
You must be signed in to change notification settings - Fork 16
/
gulpfile.js
45 lines (38 loc) · 1.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
var gulp = require('gulp'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
minifyCss = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
browserSync = require('browser-sync').create();
gulp.task('dependencies', function() {
gulp.src('bower_components/normalize-css/normalize.css')
.pipe(rename('_normalize.scss'))
.pipe(gulp.dest('scss/libs'));
});
gulp.task('sass', function() {
gulp.src('scss/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 20 versions'],
cascade: false
}))
.pipe(gulp.dest('./css/'))
.pipe(minifyCss())
.pipe(rename('style.min.css'))
.pipe(gulp.dest('./css/'));
});
gulp.task('dist', function() {
gulp.src(['index.html'])
.pipe(gulp.dest('./'));
});
gulp.task('watch', function() {
browserSync.init({
server: "./"
});
gulp.watch('scss/**/*.scss', ['sass']).on('change', browserSync.reload);
gulp.watch('index.html', ['dist']).on('change', browserSync.reload);
gulp.watch('js/*.js', ['dist']).on('change', browserSync.reload);
});
gulp.task('default', ['dependencies', 'sass', 'watch'], function() {
gulp.start('dist');
});