-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·62 lines (46 loc) · 1.42 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
61
62
'use strict';
var gulp = require('gulp'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
prefix = require('gulp-autoprefixer'),
livereload = require('gulp-livereload'),
sassGlob = require('gulp-sass-glob');
// Directory for storing sass and css files
var sassFiles = './sass/**/*.scss';
var cssDir = '.';
gulp.task('sass', function () {
return gulp
// Find all the .scss files.
.src(sassFiles)
// Enable globbing.
.pipe(sassGlob())
// Initialize sourcemaps.
.pipe(sourcemaps.init())
// Run Sass
.pipe(sass({
includePaths: [
'./node_modules/breakpoint-sass/stylesheets/',
'./node_modules/@fortawesome/fontawesome-free/scss'
],
errLogToConsole: true,
outputStyle: 'expanded'
}).on('error', sass.logError))
// Run autoprefixer. Supports ie9 and above
.pipe(prefix({
browsers: ['last 2 versions'],
cascade: false
}))
// Write sourcemaps.
.pipe(sourcemaps.write())
// Write the resulting CSS in the output folder.
.pipe(gulp.dest(cssDir))
// Reload it.
.pipe(livereload());
});
// Keep an eye on Sass files for changes...
gulp.task('watch', function () {
livereload.listen();
gulp.watch(sassFiles, gulp.series('sass'));
});
// What tasks does running gulp trigger?
gulp.task('default', gulp.series('sass', 'watch'));