-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (34 loc) · 1.05 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
const gulp = require('gulp'),
watch = require('gulp-watch'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
autoprefixer = require('gulp-autoprefixer'),
sourcemaps = require('gulp-sourcemaps'),
connect = require('gulp-connect');
const metalsmith = require('./metalsmith.js')
gulp.task('metalsmith', function() {
metalsmith.build(err => {
if (err) throw err;
});
});
gulp.task('sass', function() {
return gulp.src('./scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(autoprefixer(['last 2 versions', '> 5%', 'Firefox ESR']))
.pipe(gulp.dest('./assets/css'))
.pipe(connect.reload());
});
gulp.task('connect', function() {
connect.server({
root: 'build',
livereload: true
});
});
gulp.task('watch', function() {
gulp.watch(['contents/**/*', 'layouts/**/*'], ['metalsmith']);
gulp.watch(['scss/**/*.scss'], ['sass', 'metalsmith']);
});
gulp.task('build', ['sass', 'metalsmith']);
gulp.task('default', ['connect', 'watch']);