-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
45 lines (37 loc) · 1.16 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
//https://css-tricks.com/gulp-for-beginners/
var gulp = require('gulp'),
sass = require('gulp-sass'),
stylus = require('gulp-stylus'),
cleanCSS = require('gulp-clean-css'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
browserSync = require('browser-sync').create();
gulp.task('sass', function(){
return gulp.src('dist/css/style.css')
.pipe (sass())
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(autoprefixer())
.pipe(concat('style.min.css'))
.pipe(gulp.dest('dist/css/'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('browserSync', function(){
browserSync.init({
server: {
baseDir: 'dist'
},
port: 8080,
startPath: 'index.html',
});
});
gulp.task('watch', ['browserSync', 'sass' /*'stylus'*/], function(){
gulp.watch('src/scss/**/*.scss', ['sass']);
gulp.watch('src/stylus/**/*.styl', ['stylus']);
// Recarrega o navegador sempre que os arquivos HTML ou JS forem alterados
gulp.watch('dist/*.html', browserSync.reload);
gulp.watch('dist/js/**/*.js', browserSync.reload);
gulp.watch('dist/css/**/*.css', browserSync.reload);
gulp.watch('dist/css/**/*.min', browserSync.reload);
});