-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (35 loc) · 922 Bytes
/
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
const gulp = require('gulp');
const stylus = require('gulp-stylus');
const poststylus = require('poststylus');
const uglify = require('gulp-uglifyjs');
const browserSync = require('browser-sync').create();
gulp.task('stylus', () => {
gulp.src('style.styl')
.pipe(stylus({
use: [
poststylus(['autoprefixer'])
]
}))
.pipe(gulp.dest('./dist'))
.pipe(browserSync.reload({ stream: true }));
});
gulp.task('js', () => {
gulp.src('js/*.js')
.pipe(uglify('main.min.js'), {
outerSouceMap: true
})
.pipe(gulp.dest('./dist'))
.pipe(browserSync.reload({ stream: true }));
});
gulp.task('watch', () => {
gulp.watch('js/*.js', ['js']);
gulp.watch('style.styl', ['stylus']);
});
gulp.task('browsersync', function() {
browserSync.init({
server: {
baseDir: './'
}
});
});
gulp.task('default', ['browsersync','js','stylus','watch']);