-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
49 lines (37 loc) · 1.23 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
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
minifycss = require('gulp-minify-css'),
plumber = require('gulp-plumber'),
filter = require('gulp-filter'), // for sass source-map
gutil = require('gulp-util'), // Utility functions for gulp plugins
browserSync = require("browser-sync"),
rename = require('gulp-rename');
var sass_settings = {
sourcemap: false,
style: 'expanded',
loadPath: 'bower_components'
}
// browser-sync task for starting the server.
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: 'example'
}
});
});
gulp.task('styles', function() {
return gulp.src('example/scss/*.scss')
.pipe(plumber())
.pipe(sass(sass_settings))
.on('error', gutil.log)
.pipe(gulp.dest('example/css'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('example/css'))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('watch-example', function() {
gulp.watch('example/scss/*.scss', ['styles', browserSync.reload]);
});
gulp.task('build-example', ['styles']);
gulp.task('default', ['watch-example']);