-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (35 loc) · 1.1 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
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var input = './scss/**/*.scss';
var output = './';
var sassOptions = {
errLogToConsole: true,
outputStyle: 'expanded'
};
gulp.task('sass', function () {
return gulp
// Find all `.scss` files from the `stylesheets/` folder
.src(input)
.pipe(sourcemaps.init())
// Run Sass on those files
.pipe(sass(sassOptions).on('error', sass.logError))
.pipe(sourcemaps.write(output))
.pipe(autoprefixer())
// Write the resulting CSS in the output folder
.pipe(gulp.dest(output));
});
gulp.task('watch', function() {
return gulp
// Watch the input folder for change,
// and run `sass` task when something happens
.watch(input, ['sass'])
// When there is a change,
// log a message in the console
.on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
});
gulp.task('default', ['sass', 'watch' /*, possible other tasks... */]);