-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (49 loc) · 1.24 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
51
52
53
54
55
const gulp = require('gulp')
const bs = require('browser-sync')
const sass = require('gulp-sass')
const prefixer = require('gulp-autoprefixer')
const concat = require('gulp-concat')
const gutil = require('gulp-util')
const babili = require('gulp-babili')
const paths = {
css: ['assets/stylesheets'],
img: ['assets/images'],
js: ['assets/javascripts'],
sass: ['assets/sass']
}
gulp.task('default', () => {
gulp.start('server')
})
gulp.task('livereload', () => {
bs.init({
server: {
baseDir: './'
},
open: false,
reloadOnRestart: true
})
gulp.watch(`${paths.sass}/**/*.scss`, ['sass'])
gulp.watch(['index.html', 'test.html'], bs.reload)
gulp.watch(`${paths.js}/**/*.js`, bs.reload)
gulp.watch(`${paths.css}/**/*.css`, bs.reload)
})
gulp.task('sass', () => {
return gulp.src(`${paths.sass}/**/*.scss`)
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(prefixer({
browsers: ['last 10 version', 'ie 10', 'ie 9']
}))
.pipe(gulp.dest('assets/stylesheets'))
})
gulp.task('concat-js', () => {
gulp.src(`${paths.js}/main.js`)
.pipe(concat('main.min.js'))
.pipe(babili({
mangle: {
keepClassName: true
}
}).on('error', gutil.log))
.pipe(gulp.dest('assets/javascripts'))
})