-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
44 lines (37 loc) · 1.02 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
const gulp = require('gulp');
const prettier = require('gulp-prettier');
const autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
function browserPrefixer(){
return gulp.src('css/**/*.css')
.pipe(autoprefixer({
browsers: ['last 2 versions']
}))
.pipe(gulp.dest('./css'))
.pipe(browserSync.reload({
stream: true
}));
}
gulp.task('browserPrefixer', browserPrefixer);
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: './'
},
port: 8081, //browser url port
ui: {
port: 8080
},
})
})
gulp.task('watch', ['browserPrefixer', 'browserSync'], function (){
gulp.watch('css/**/*.css', ['browserPrefixer']);
// Reloads the browser whenever HTML or JS files change
gulp.watch('*.html', browserSync.reload);
gulp.watch('js/**/*.js', browserSync.reload);
});
gulp.task('prettier', () => {
return gulp.src('js/**/*.js')
.pipe(prettier({ singleQuote: true }))
.pipe(gulp.dest('./js'));
});