-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (41 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
46
47
48
49
50
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync'),
autoprefixer = require('gulp-autoprefixer'),
sourcemaps = require('gulp-sourcemaps');
gulp.task('css', function () {
return gulp.src('src/scss/style.sass')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer('last 4 version'))
.pipe(gulp.dest('app/assets/css'))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('js', function () {
gulp.src('src/assets/js/scripts.js')
.pipe(sourcemaps.init())
.pipe(gulp.dest('app/assets/js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('app/assets/js'))
.pipe(browserSync.reload({
stream: true,
once: true
}));
});
gulp.task('browser-sync', function () {
browserSync.init(null, {
server: {
baseDir: "app"
}
});
});
gulp.task('bs-reload', function () {
browserSync.reload();
});
gulp.task('default', ['css', 'js', 'browser-sync'], function () {
gulp.watch("src/scss/**/*.*", ['css']);
gulp.watch("src/assets/js/*.js", ['js']);
gulp.watch("app/*.html", ['bs-reload']);
});
gulp.task('build', ['css', 'js', ])