This repository was archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
69 lines (57 loc) · 1.45 KB
/
gulpfile.js
File metadata and controls
69 lines (57 loc) · 1.45 KB
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
// Gulp & utilities
var gulp = require('gulp');
var gutil = require('gulp-util');
var watch = require('gulp-watch');
// CSS
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var csso = require('gulp-csso');
// Browser Sync
var browserSync = require('browser-sync').create();
/* ================= */
/* CSS Files */
// Compile SASS and Autoprefix.
gulp.task('sass', function () {
gulp.src('sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(sass({
outputStyle: 'expanded'
}))
.pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {
cascade: true
}))
// Minify CSS
// .pipe(csso())
.pipe(gulp.dest('css'))
.pipe(browserSync.stream());
});
// Browser Sync
// see https://www.browsersync.io/docs/gulp/
/*
// Dynamic server
gulp.task('browser-sync', function() {
browserSync.init({
proxy: "yourlocal.dev"
});
});
*/
// Static server
gulp.task('browser-sync', function () {
browserSync.init({
server: {
baseDir: "./"
}
});
});
/* ================= */
/* Gulp Watch */
gulp.task('watch', function () {
// watch scss files
gulp.watch('sass/**/*.scss', ['sass']);
gulp.watch("*.html").on('change', browserSync.reload);
});
/*gulp.task('default', function() {
// place code for your default task here
});
*/
gulp.task('default', ['sass', 'browser-sync', 'watch']);