-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
60 lines (51 loc) · 1.45 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
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var cleanCSS = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');
var rename = require('gulp-rename');
var reload = browserSync.reload;
var src = {
scss: 'src/pronto.scss',
scsssubs: 'src/pronto/**/*.scss',
demo: 'demo/demo.scss',
html: 'index.html'
};
var dest = 'dist/';
// Static Server + watching scss/html files
gulp.task('serve', ['demo', 'sass'], function() {
browserSync.init({
server: "./"
});
gulp.watch([src.scss, src.scsssubs, src.demo], ['demo', 'sass']);
gulp.watch([src.html]).on('change', reload);
});
// Compile sass into CSS
gulp.task('sass', function() {
return gulp.src(src.scss)
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(dest))
.pipe(rename({
suffix: '.min'
}))
.pipe(sourcemaps.init())
.pipe(cleanCSS())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(dest));
});
// Compile demo files
gulp.task('demo', function() {
return gulp.src(src.demo)
.pipe(sass().on('error', sass.logError))
.pipe(rename({
suffix: '.min'
}))
.pipe(sourcemaps.init())
.pipe(cleanCSS())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('demo/'))
.pipe(reload({
stream: true
}));
});
gulp.task('default', ['serve']);