-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (36 loc) · 1.13 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
//TODO
// - css maps dentro de src
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var sass = require('gulp-sass');
var watch = require('gulp-watch');
var webserver = require('gulp-webserver');
// Plugins do postcss
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');
// Sass roda primeiro compilando tudo pra css, daí pra diante entra o
// postcss pra minificar, gerar mapas, fazer autoprefix etx.
gulp.task('style', function () {
return gulp.src('src/sass/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(postcss([ //aqui passa os plugins do postcss
autoprefixer(), //autoprefixer, configuração na chave 'browserslist' do package.json
cssnano({ // minificador, presets diferentes podem ser passados
preset: 'default'
})
]))
.pipe(gulp.dest('assets/css'))
});
gulp.task('watch', function (){
gulp.watch('src/sass/*.scss', ['style']);
});
gulp.task('webserver', function() {
gulp.src('./')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: true,
port: 8001
}));
});
gulp.task('default', ['style', 'webserver', 'watch']);